syntax questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax questions

Jason Kinzer
Greetings,

A couple questions w.r.t. syntax:

- It seems the lexer doesn't like access on the 'class' member (e.g. the expression "Employee.class" yields the error "identifier expected but 'class' found"). In my case this is an annoyance because a tool I'm using (a lightweight ORM) requires the class name to be mentioned as part of it's required metadata. Is this a bug or intended behavior?

- I'd love to see a builtin tuple syntax -- e.g. (x,y,z) instead of Tuple3(x,y,z) for [de]constructors -- is that a remote possibility? As an ML user, the former feels quite a bit more elegant... but I guess Scala's probably not targeting my demographic quite as heavily, as say, Java users ;-)

Cheers,
Jason
Reply | Threaded
Open this post in threaded view
|

Re: syntax questions

Lex Spoon
Jason Kinzer <[hidden email]> writes:
> - It seems the lexer doesn't like access on the 'class' member (e.g. the
> expression "Employee.class" yields the error "identifier expected but
> 'class' found"). In my case this is an annoyance because a tool I'm using (a
> lightweight ORM) requires the class name to be mentioned as part of it's
> required metadata. Is this a bug or intended behavior?


I don't believe you can do this right now.  A possible workaround is:

        new Employee().getClass()


Getting .class to work in a Java-like way has a problem in that Scala
classes don't map to just one Java item.  They map at least to a class
and an interface, and sometimes more.  On top of that, the mapping for
CLR might or might not be the same.



> - I'd love to see a builtin tuple syntax -- e.g. (x,y,z) instead of
> Tuple3(x,y,z) for [de]constructors -- is that a remote possibility? As an ML
> user, the former feels quite a bit more elegant... but I guess Scala's
> probably not targeting my demographic quite as heavily, as say, Java users
> ;-)

Many people share your pain.  I don't know if it's doable or not,
e.g. if it would cause ambiguities elsewhere in the syntax.  I've
missed it too, though.


-Lex