Re:Brace : Dialect of C that looks like Python
by tumult on Sunday November 08, 2009 @03:27PM
(#929748)
That's not trivial, suddenly you have to have type inference. 1? Did you mean an int? Float? Double? 8 bits? 16? 32? 64? signed? unsigned?
[ Parent
| on HN ]
Re:Brace : Dialect of C that looks like Python
by viraptor on Sunday November 08, 2009 @08:19PM
(#930157)
> 1? Did you mean an int?
1
> Float?
1.0f
> Double?
1.0
> 8 bits? 16?
Those would actually need the type.
> 32?
1
> 64?
1ll
> signed?
1
> unsigned?
1u
C copiler already does that "inference" when you pass an attribute into a function - so why not when you declare the variable?
Re:Brace : Dialect of C that looks like Python
by tumult on Sunday November 08, 2009 @08:41PM
(#930194)
because you can write to a variable or pass it to more than one function
Re:Brace : Dialect of C that looks like Python
by viraptor on Sunday November 08, 2009 @09:09PM
(#930234)
So you can infer the type on the first usage only and then treat the variable like it has a static type (because it does). That's what most type-inferring, static languages do.
Re:Brace : Dialect of C that looks like Python
by tumult on Sunday November 08, 2009 @09:24PM
(#930256)
the really smart, immutable ones, could let you treat the expression as any of those types as you like. this is supposed to be a cleaner C syntax, not another platform.
Re:Brace : Dialect of C that looks like Python
by pgbovine on Sunday November 08, 2009 @03:47PM
(#929783)
yup, agreed. type inference for a dynamically-typed language is extremely hard to do well ... you often have to make people program in a restricted 'static' subset of the language, like what PyPy does with the RPython dialect:
http://codespeak.net/pypy/dist/pypy/doc/coding-guide.html#re...