lua-users home
lua-l archive

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


On Thu, Feb 28, 2008 at 9:16 PM, Asko Kauppi <askok@dnainternet.net> wrote:
>         local function mydear( t :string_or_table, i :int, j :[int], n :
>  [number] )
>             : string, table, [int]
>                 ...function body with returns...
>         end

Nice notation!  I was thinking about this general problem the other
day: how does one explcitly specify type in a dynamic language? The
idea was that types are objects, and one builds them up with
expressions:
    string_or_table = choice(String,Table)
    string_or_nil = choice(String,Nil)
    Location = choice({X=Double,Y=Double},{Double,Double})

A more interesting question is how far one can push static type
inference. I had a brief affair with Boo, which is a Python-like
compiled language where the only type annotations are usually in
method signatures. Cool, but boy the compiler was slow!

steve d.