[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: another hat in the ring regarding Lua 5.2: static typing
- From: "steve donovan" <steve.j.donovan@...>
- Date: Fri, 29 Feb 2008 10:04:42 +0200
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.