Redefining If
I had time today to sit on several Brail bugs. I keep getting more and more and more amazed by the power that Boo is giving me.
In order to fix some of those bugs, I had to literally change the meaning of the if statement. (I defined my own nullable propagator, which I had to implement deeply into the language).
Damn, I love this language.
Oh, and FYI, if 2+2 == 4 will not do the expected thing anymore :-)
Comments
How did you redefine if? A custom compiler step?
Yeah, fairly amazing.
https://svn.castleproject.org/svn/castle/trunk/MonoRail/
Castle.MonoRail.Views.Brail/FixTryGetParameterConditionalChecks.cs
Basically, transform "if ?Errors" to "if not TryGetParameter("Errors") isa IgnoreNull"
And what about the Principle of Least Surprise... breaking your own rules, eh? :)
Ayende,
I worship you like a god (small G) but.. seriously 'redefining if'.. argh, sounds much more like something one would read at the daily wtf (worsethanfailure.com) than here..
Steven,
that was a joke, I am afraid.
Moles,
Oh, then I guess I shouldn't tell when I did to the goto statement, then :-D
Haha... my bad. I guess my sarcasm didn't quite come across... I seem to have trouble with that when it comes to written communication. I supposed I could have used a little markup to help.
<sarcasm> insert snarky comment here </sarcasm>
:)
Uhm, maybe I'm not reading it right, but wouldn't it be easier to make your null object equal to null by overriding Equals()? then you'd still be able to do "if ?Errors" etc. What am I missing?
It would be easier, but Boo emits an op_Equality test, and since we are dealing with duck typing here, it will not note the user defined op_Equality or the Equals() override
Comment preview