tag:blogger.com,1999:blog-3573606178901893990.post5209573273471495252..comments2024-01-28T01:30:51.917-08:00Comments on The Monkey's Grinder: C#erUnknownnoreply@blogger.comBlogger12125tag:blogger.com,1999:blog-3573606178901893990.post-64312291242660417552009-12-23T19:53:11.424-08:002009-12-23T19:53:11.424-08:00Does it work with interfaces? Perhaps composition...Does it work with interfaces? Perhaps composition of base types?<br /><br />new (MyBase, IFoo, IBar)<br />{ <br /> MyBaseImpl(string, int) = (s, i) => { ... },<br /> IFoo.FooValue = 1,<br /> IBar.BarValue = 2,<br /> SharedFooBarEvent +=> (s, e) => DoSomething(s, e) <br />}Keith J. Farmerhttp://www.thuban.orgnoreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-82283745286316854242009-12-22T08:57:32.721-08:002009-12-22T08:57:32.721-08:00Assigning Event Handlers in the Object initializer...Assigning Event Handlers in the Object initializer using +=>? Awesome idea! Does it support Arguments for the Events where we DO need the EventArgs? (i.e. all Keyxxx Events)?<br /><br />Overloading the => Operator and creating ambiguity? meh.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-6279304574935771642009-09-10T14:18:45.276-07:002009-09-10T14:18:45.276-07:00"Don't argue with me, because you're ..."Don't argue with me, because you're wrong."<br /><br />Oh crap...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-2246499417788620512009-07-28T01:54:02.444-07:002009-07-28T01:54:02.444-07:00This is awesome :)
Think:
- compiler as a service...This is awesome :)<br /><br />Think:<br />- compiler as a service<br />- meta programming<br />- compiler addins.<br /><br />If you do this right, microsoft might find itself playing catchup with mono at some day. :)zproxyhttps://www.blogger.com/profile/06430406136997986616noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-38690338259231995792009-07-27T19:06:18.324-07:002009-07-27T19:06:18.324-07:00abock:
So what you're telling us is that you&...abock:<br /><br />So what you're telling us is that you're <i>not</i> manly man enough for such festivities?<br /><br />Color me disappointed, sir. ;)Ed Ropplehttps://www.blogger.com/profile/12337405886520395876noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-39578889389932028442009-07-27T14:35:28.400-07:002009-07-27T14:35:28.400-07:00Actually you're right:
x.Foo += { Apples (); ...Actually you're right:<br /><br />x.Foo += { Apples (); Oranges (); }<br /><br />does look better. Although since intList = { 1 } actually means add '1' to the intList collection, I thought the 'add' concept could also be applied when adding to an event handler. But for the sake of readability I think you're right we should always have the += amd -= when dealing with events.<br /><br />No definitely nothing wrong with the experimenting with the language. I believe that's what MS is doing with their research languages, before they take the best stuff mainstream into c#.<br /><br />I just worry about lots of individuals extending a language to add a feature which they think is cool. Without any authoritative leadership we could end up with C#++.<br /><br />Otherwise if you're just exploring new features with a hope that some of them will make it into a subsequent release then please someone send a patch for some String Interpolation goodness ;)Mythzhttps://www.blogger.com/profile/03338857573336749616noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-15684328199332017012009-07-27T12:46:31.604-07:002009-07-27T12:46:31.604-07:00Firstly, there is nothing wrong with experimenting...Firstly, there is nothing wrong with experimenting with the language. <br /><br />Anders et. al. have done a fantastic job of balancing language features with skeptical conservatism and also taking in some really great features over the iterations.<br /><br />C# is a very well crafted, clean, and beautiful language. No one wants to break that.<br /><br />While I do think more functionality should be allowed in the object initializer syntax (especially event handler support, _maybe_ even method calls on that object), I was merely expressing a syntactical annoyance with the lambda syntax.<br /><br />I particularly like the { } syntax for anonymous methods in Boo, but I think the => operator is still good for clarity.<br /><br />+=> maybe not so much - it was just an idea of mine. But since += implies you will be assigning a delegate to an event, then maybe the lack of => at all is acceptable in this case:<br /><br />x.Foo += Console.WriteLine ("Hi");<br />x.Foo += { Apples (); Oranges (); };<br /><br />But for non-event assignment of delegates, this syntax would be confusing and ambiguous (does Apples return a delegate to be assigned to Foo, or is Apples being invoked inside of an anonymous method?):<br /><br />x.Foo = Apples ();<br /><br />Proposing to wrap that in { } is more Boo like, solves the ambiguity above, and isn't too bad, but here I think the => works really well (not to mention being more terse):<br /><br />x.Foo => Apples ();<br />x.Foo => { Oranges (); Peaches (); };<br /><br />Generally, I like the => since it says to me "Foo will be going to (e.g. invoking) Apples" whereas a simple = says to me "Apples will be going to foo (e.g. assigning)." => Conveys direction and intention.<br /><br />Of course, to clarify, none of Scott's changes are actually going into the mainline Mono C# compiler. We're just exploring the space.<br /><br />Scott was joking about including the experimental compiler and changing all our source code to use these tiny new conveniences.Aaron Bockoverhttps://www.blogger.com/profile/00632889292342377561noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-52180885855533545652009-07-25T14:44:12.886-07:002009-07-25T14:44:12.886-07:00man that syntax is ugly and unintuitive. If *it ha...man that syntax is ugly and unintuitive. If *it has to* to be any more terse I would adopt Scott's suggestion instead:<br /><br />Bar = { Console.WriteLine(<br />"What does this ASCII art even mean?") }<br /><br />The only thing I would like that's not in c# 4.0 is String Interpolation (http://boo.codehaus.org/String+Interpolation)<br /><br />Other than that, you really shouldn't be forking from the core language specification at all IMO. Any few bytes of code you save will be dwarfed by the pain you introduce when writing 'mono specific' c# code.<br /><br />Leave the language design up to the C# design team, they've done a great job so far.Mythzhttps://www.blogger.com/profile/03338857573336749616noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-70003346189683647752009-07-24T15:23:07.371-07:002009-07-24T15:23:07.371-07:00I want XML literals in C#. That's the only th...I want XML literals in C#. That's the only thing VB9 really has on us.R. Lawsonhttps://www.blogger.com/profile/08264939411631488535noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-29110723966580356822009-07-24T11:43:49.395-07:002009-07-24T11:43:49.395-07:00unsollicited
hmmm
indeed
very nice but a bit on...unsollicited<br /><br />hmmm<br /><br />indeed<br /><br />very nice but a bit on the spur. there is a reason why Hejlsberg c.s. keep fretting on small syntax convolutions, semantic changes. They don't want c# to be the next C++ quite that soon.Amberhttps://www.blogger.com/profile/02588145544781882509noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-41635603032572412482009-07-24T11:15:05.000-07:002009-07-24T11:15:05.000-07:00Honestly, I think we're all getting distracted...Honestly, I think we're all getting distracted by the '=>' assignment operator.<br /><br />I hope one day to do this in a way that seems strait forward, like:<br /><br />Bar = { Console.WriteLine(<br /> "What does this ASCII art even mean?") }<br /><br />Let's look beyond the assumption that the '=>' is necessary or even good.Anonymoushttps://www.blogger.com/profile/10851121926952875016noreply@blogger.comtag:blogger.com,1999:blog-3573606178901893990.post-31613839211541606442009-07-24T10:51:40.475-07:002009-07-24T10:51:40.475-07:00So this is really two largely separate ideas, righ...So this is really two largely separate ideas, right?<br /><br />Supporting event handlers in property initialization blocks makes perfect sense.<br /><br />The new => and +=> syntax is more controversial. Correct me if I'm wrong, but it strikes me as a lambda-like replacement for the parameter-ignoring delegate { ... }, which I've also wanted.<br /><br />I wonder if syntax like (...) => whatever() would be less confusing and more generally useful. A few more keystrokes than you are proposing, obviously.Edhttps://www.blogger.com/profile/13444356286425602841noreply@blogger.com