Automatic typing

Ary Borenszweig ary at esperanto.org.ar
Sat Jun 29 14:53:40 PDT 2013


On 6/29/13 6:01 PM, Walter Bright wrote:
> 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!"

Sorry, but I can't imagine those bugs. Can you show me an example?


More information about the Digitalmars-d mailing list