Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 10th, 2005, 1:57 AM   #11
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

Quote:
Originally Posted by Cerulean
How do you mean? How would Microsoft give boo Mono support? Firstly, last time I checked Microsoft had very little / nothing to do with Mono, and secondly - Boo works with Mono fine :-)
Sorry, the Mono was in there to show that is is similar to NET. I am quite sure Bill hates open source Mono.

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!
Dietrich is offline   Reply With Quote
Old Nov 10th, 2005, 3:13 AM   #12
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Dietrich
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)".
C macros aren't true macros in the Lisp sense. Lisp and Boo macros are a method of redefining, or adding to, the grammar of the language on the fly. This makes macros very, very powerful constructs, as you might well imagine. So far as I know, Boo is the only existing procedual language that has this ability.

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.
Arevos is offline   Reply With Quote
Old Nov 11th, 2005, 10:41 AM   #13
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

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!
Dietrich is offline   Reply With Quote
Old Nov 11th, 2005, 6:39 PM   #14
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Dietrich
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!
There's some information on Boo macros here and some examples here.

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   1
Macros are language constructs used to manipulate parts (subtrees) of the AST. They first cropped up in Lisp some decades back, and Boo has the same ability. In Boo, macros seem to have the syntax:
macro_name arguments...:
   <block of code>
// or
macro_name arguments { <block of code> }
When the block of code is parsed into an AST, the AST object is passed to the macro for extra processing. The macro can manipulate the subtree AST in any way it wishes. Presumably, one could even store bits of it for later.

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
At least, that's what an ideal macro system would be able to do.
Arevos is offline   Reply With Quote
Old Nov 12th, 2005, 9:59 AM   #15
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

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!
Dietrich is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC