Automatic typing
Walter Bright
newshound2 at digitalmars.com
Sat Jun 29 14:01:54 PDT 2013
On 6/29/2013 12:18 PM, Ary Borenszweig wrote:
> What you are asking is essentially what Crystal does for all variables (and types):
>
> https://github.com/manastech/crystal/wiki/Introduction#type-inference
>
> Your example would be written like this:
>
> x = 3
> y = f()
> x = 3.9
>
> But since Crystal transforms your code to SSA
> (http://en.wikipedia.org/wiki/Static_single_assignment_form) you actually have
> *two* "x" variables in your code. The first one is of type Int32, the second of
> type Float64.
Sorry, but that seems like a solution in search of a problem.
And besides, yuk. Imagine the bugs caused by "hey, it doesn't implicitly
convert, so instead of letting the user know he goofed, let's just silently
create a new variable!"
More information about the Digitalmars-d
mailing list