[antlr-interest] language design

Edwards, Waverly Waverly.Edwards at genesys.com
Thu May 7 07:16:03 PDT 2009



This question is not directly aimed at ANTLR but towards language design.
If someone wouldn't mind responding or directing me towards the answer to
why would I want a primitive type to be treated as an object.  In Java and C#,
primitive types are treated as objects.  It seems to me that by doing so, you
would increase the overhead of converting values and thus it would become a
detriment to the language.  It appears that you might want this to part of your
language to make it easier for the user/developer.


The only example that comes to mind is something like this

[simple language]

Integer BirthYear
String showBirth

showBirth = "You were born in " + BirthYear.toString()

print display


I don't see the benefit of making a primitive type an object other than to
make it easier to perform operations the user can perform in other ways
with less overhead.   I can make more of an argument for making composite
types as objects.

I have a couple of books on language design but none of them address this issue.
I believe this would fall under boxing and unboxing.  If someone could direct me
towards a good reason to implement this in a language, it would be very much
appreciated.


Thank you,


Waverly.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090507/13386bca/attachment.html 


More information about the antlr-interest mailing list