Sponsored Link •
|
Summary
Since Heron syntax is C++ based, I am experimenting to see what happens when you drop the requirement for the this keyword.
Advertisement
|
In my attempt to mimic C++ syntax, but increase flexibility I have ended up with a legal statement which may raise eyebrows:
* * *;The * as a unary operator by default means *this. The * as a binary operator commonly means multiply (it maps to a function _star). So * * * will in some cases result in a square operation. This should not be confused with *** which maps to the function: _star_star_star when used as a binary operator, or to _pre_star_star_star() when used as a unary operator.
I can write the BNF rules unambiguously, but the question is, is this a very bad idea?
Have an opinion? Readers have already posted 12 comments about this weblog entry. Why not add yours?
If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.
Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com. |
Sponsored Links
|