lua-users home
lua-l archive

Re: On adding type information to a dynamically typed language

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Forget about my last post .... stupid idea ;)
Am 22.09.2017 um 08:59 schrieb Ulrich Schmidt:
I like it! But i still i dont like any prefix solution / funtion call for this task. I would like to write in my sources something like:
   f(x.string(), y.number())
or better:
   f(x.string, y.number)
hence we have to modify the metatables for all data types. Each metatable needs only 1 method: string() for string metatable, number() for number metatable and so on. This function should return the value itself. If i call for instance x.string() on a number value, the method is undefined and a error is raised.
May be i dont see the drawbacks of this idea?
Ulrich.

AltStyle によって変換されたページ (->オリジナル) /