![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Quote:
Macros have always been frowned upon in the C community as a good source of nasty errors, but then C# code can be a little long winded! Who wouldn't like to write "print x" rather than "System.Console.WriteLine(x)".
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
|
#12 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
Boo macros are also likely to be more robust than C's. In C, macros are simple substitutions done at compile time. In Boo, they're object-orientated extensions to the parser. |
|
|
|
|
|
|
#13 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
I went back to the Boo site and looked at the macro information there. It's pretty sparse. Where did you find your information? It makes macros indeed more interesting!
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
#14 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
I've dug about in Lisp a bit, so I could recognise the similarity between Boo macros and those in Lisp. When most languages are compiled, they are first construsted into an AST or Abstract Syntax Tree. For instance, the expression "x + 1" might evaluate into a AST that looks like: +
/ \
x 1macro_name arguments...:
<block of code>
// or
macro_name arguments { <block of code> }This allows the programmer to dynamically create localised syntax extensions to the language during runtime. I'm unsure quite how flexible Boo's macro system is, and how much it checks the AST before passing it on to the macro, but in theory, one might be able to do something like this: // Work in reverse polish form! reverse_polish: 1 1 + = two two 3 * = six |
|
|
|
|
|
|
#15 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Thanks,
looks like one has to read between the lines, after one gets through all that endless legal mumbo jumbo. Looks like there are 100 lines of copyright messages for every line of code published. Does a simple print "Hello!" really need all that legal stuff, or are we dealing with rather strange folks? I tried to run some of the given examples, but most don't work because of missing import modules/namespaces. Where on earth is Boo.IO? Maybe a few years down the road Boo will have the act together. I downloaded Boodle, a sweet little IDE for Boo. That one actually works well!
__________________
I looked it up on the Intergnats! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|