Forums

Syntax relaxation on var

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: Syntax relaxation on var

Postby natter » Thu Nov 06, 2008 5:52 pm

Where would the .x and .y come from?


from automaticly generating them by inference at compile time.

is it really that bad? i find it annoying to declare vars at all.
natter
 
Posts: 20

Re: Syntax relaxation on var

Postby Charles » Thu Nov 06, 2008 6:01 pm

I don't think it's trivial to infer those at compile time. Then there's the issue that if you misspell one like:
e.namee = whatever

You end up with an extra var that's never getting used. Most probably this is a bug.

Also, explicit declarations benefit the reader of your class as it grows in size. All things considered, Cobra's class declarations will remain explicit. So:
class Point

def init(x as int, y as int)
_x, _y = x, y

get x from var as int

get y from var as int

get isPositive as bool
return .x > 0 and .y > 0
Charles
 
Posts: 2515
Location: Los Angeles, CA

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 105 guests

cron