Syntax improvement FTW

Published April 14, 2009
Advertisement
I'm sure some of you will be excited to know that I've finally gotten around to implementing infix operators in Epoch. Right now all I've got is basic arithmetic, but the framework should be very easy to extend to pretty much any operator imaginable.

In fact, the framework is specifically designed to allow the programmer to define his own new infix operators, including setting their precedence level. This should make Epoch quite a bit more expressive and succinct than it has been thus far - and I haven't even touched the syntax skinning concept yet.


I have a huge amount of stuff to get done for R7, and possibly won't get much free time to hack on it for a while; but here's the general list of what else is coming:

  • Full set of infix operators

  • Unary operators

  • Parenthetical expressions (for overriding precedences)

  • Improved support for literals in the cast operation

  • Removal of hardcoded strings in the VM code; using a keyword table instead

  • Replace message allocator with a custom pooled allocator to avoid locking on the heap during new/delete

  • Fix some memory leak issues

  • Correct nested response map issues

  • Improved error reporting, esp. during task validation

  • Improved syntax for initializing structures

  • Buffer entity (support for both stack and heap allocation)

  • Better VM-level error reporting

  • Type aliases (i.e. typedefs)

  • Map/reduce functions

  • Futures

  • Change task IDs to string variables so we can refer to tasks from code

  • Introduce a new TaskHandle type in the VM (currently we just use Integer)

  • Stop directly using size_t etc. and instead use descriptive typedefs

  • Improvements to exception safety

  • Correct some cases involving private vs. protected

  • Simplify type metadata lookups, e.g. TypeInfo::GetStorageSize()

  • Perform a complete code review, for exception safety, documentation, code cleanliness, error handling robustness, and elimination of hardcoded strings/magic numbers



Expect R7 sometime around the heat death of the universe.
Previous Entry Woohoo! GDC stuff is done
Next Entry *Yawn*
0 likes 5 comments

Comments

mikeman
About syntax skinning...it's a very interesting idea, but I wonder if "too much" flexibility will actually damage the language's popularity...If everyone is able to define a syntax, wouldn't that mean communication problems between programmers working with the language? I know that you said that syntax can be transformed from one form to another, but still...I could see it causing problems in communication or forming a solid community...unless there's something I'm not seeing.
April 15, 2009 05:02 AM
Telastyn
boo user defined precedence.
yay heat death.
April 15, 2009 09:59 AM
ApochPiQ
Yeah, the problem of too many syntax variants has occurred to me as well; in fact that's pretty much the entire reason why I haven't started playing with it yet. I'm not convinced that it's a good idea, but it's very tempting... so we'll see. In any event the introduction of infix operators gets rid of the majority of complaints about the syntax, so whether or not the skinning is even necessary remains to be seen. Very much a back-burner idea for the moment. At the very least there will be a powerful pretty-printer built into the Epoch IDE.


Re: User defined operator precedence - what's the issue? To me it seems like it would be counter-productive to allow user defined operators but not permit the user to set their precedence, meaning that most code involving custom operators would be littered with parentheses to try and get the precedence correct.
April 15, 2009 12:24 PM
Telastyn
Quote:Original post by ApochPiQ
Re: User defined operator precedence - what's the issue? To me it seems like it would be counter-productive to allow user defined operators but not permit the user to set their precedence, meaning that most code involving custom operators would be littered with parentheses to try and get the precedence correct.


Sure, and that is sucky.

But having a programmer set precedence is going to (effectively) require them to guess how other programmers will set their precedences. They can make a decent guess, but if it's wrong (or if the other API changes their precedences) then you get runtime errors (occasionally compile time due to type issues) that will likely not be easy to deal with. And even when it's right there's that extra precedence info that a programmer needs to be aware of/remember when dealing with the API.

I'm not sure there's an arbitrarily better way to determine precedence for user defined operators, but I don't particularly care for the programmer setting some value for it.

April 15, 2009 12:34 PM
_goat
Yah, about flexibility vs limitations.

(Note: I'm doing a language, prism, too; it's found at the centre of the universe, apparently)

I was originally thinking of syntax skinning myself, one for a python-esque style and one for a C-style. But you have to remember that it sort of devolves into a religious war: Which style is better? I think it'd create an split in the community, so I went with purely the python-style. I also removed the ability for people to indent with 4 spaces (or more accurately x spaces). You see it all over the internets about whether or not it's better to use tabs or spaces to indent your work. Pow, taken out of the equation. Sometimes restricting what users can do increases the friendliness of the application and environment. The way I normally work is by saying "could two users do exactly the same thing in two different ways and both believe that the other is wrong"? If that could happen, I try and find a way to resolve it so there's only one way of going about things.

I'd take out syntax skinning and user-defined operator precedence (have one level of precedence set aside entirely and solely for user-defined operators).
April 17, 2009 12:59 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement