Re: Type annotations

2005-10-10 Thread TSa
HaloO, I fear I'm addicted... Luke Palmer wrote: On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote: On Fri, 2005-10-07 at 17:43 -0600, Luke Palmer wrote: No, you can't overload assignment at runtime because you can't overload assigment at any time, so says the language spec (well, not any fo

Re: Type annotations

2005-10-09 Thread Stuart Cook
The more I think about it, the more I'm convinced that perl6 (by default) shouldn't refuse to run programs because of a (perceived or real) type error. It should, of course, emit a compile-type type *warning*, which can be silenced or made fatal at the user's discretion. There are a few reasons b

Re: Type annotations

2005-10-07 Thread Yuval Kogman
On Fri, Oct 07, 2005 at 12:50:09 -0700, chromatic wrote: > On Fri, 2005-10-07 at 12:49 +0200, Juerd wrote: > > > Ashley Winters skribis 2005-10-06 19:30 (-0700): > > > > > my Array $a = 97; # dies eventually, but when? > > > Runtime -- cannot coerce Int value to Array > > > It is fully

Re: Type annotations

2005-10-07 Thread Luke Palmer
On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote: > On Fri, 2005-10-07 at 17:43 -0600, Luke Palmer wrote: > > > No, you can't overload assignment at runtime because you can't > > overload assigment at any time, so says the language spec (well, not > > any formal spec; so says Larry as far as I remem

Re: Type annotations

2005-10-07 Thread chromatic
On Fri, 2005-10-07 at 17:43 -0600, Luke Palmer wrote: > No, you can't overload assignment at runtime because you can't > overload assigment at any time, so says the language spec (well, not > any formal spec; so says Larry as far as I remember). I'm wearing my "just a programmer, not a denizen of

Re: Type annotations

2005-10-07 Thread Luke Palmer
On 10/7/05, Luke Palmer <[EMAIL PROTECTED]> wrote: > On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote: > > On Fri, 2005-10-07 at 15:22 -0600, Luke Palmer wrote: > > > But you are allowed to overload coersion. Essentially, every > > > expression gets a coerce:($expr, $current_context) wrapped around

Re: Type annotations

2005-10-07 Thread Luke Palmer
On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote: > On Fri, 2005-10-07 at 15:22 -0600, Luke Palmer wrote: > > But you are allowed to overload coersion. Essentially, every > > expression gets a coerce:($expr, $current_context) wrapped around > > it (where these are optimized away when they do nothin

Re: Type annotations

2005-10-07 Thread chromatic
On Fri, 2005-10-07 at 15:22 -0600, Luke Palmer wrote: > On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote:\ > > If I added a multisub for Array assignment so that assigning an integer > > value set the length of the array, would 97 be compatible with Array? > You're not allowed to overload assignm

Re: Type annotations

2005-10-07 Thread Luke Palmer
On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote:\ > If I added a multisub for Array assignment so that assigning an integer > value set the length of the array, would 97 be compatible with Array? You're not allowed to overload assignment. But you are allowed to overload coersion. Essentially, ev

Re: Type annotations

2005-10-07 Thread Juerd
chromatic skribis 2005-10-07 12:50 (-0700): > > > > my Array $a = 97; # dies eventually, but when? > > > Runtime -- cannot coerce Int value to Array > > It is fully determinable at compile time. 97 will never be compatible > > with Array, so I see no reason to wait. > If I added a multisub

Re: Type annotations

2005-10-07 Thread chromatic
On Fri, 2005-10-07 at 12:49 +0200, Juerd wrote: > Ashley Winters skribis 2005-10-06 19:30 (-0700): > > > my Array $a = 97; # dies eventually, but when? > > Runtime -- cannot coerce Int value to Array > It is fully determinable at compile time. 97 will never be compatible > with Array, s

Re: Type annotations

2005-10-07 Thread Juerd
Yuval Kogman skribis 2005-10-07 12:53 (+0200): > On Fri, Oct 07, 2005 at 12:42:01 +0200, Juerd wrote: > > For my Int $c = $float, though, I'd want coercion. > > And I think it is wrong to have such a huge difference between literals > > and values: if a variable coerces, a literal has to do so too.

Re: Type annotations

2005-10-07 Thread Yuval Kogman
On Fri, Oct 07, 2005 at 12:42:01 +0200, Juerd wrote: > For my Int $c = $float, though, I'd want coercion. > > And I think it is wrong to have such a huge difference between literals > and values: if a variable coerces, a literal has to do so too. How do you tell the compiler "this must never be a

Re: Type annotations

2005-10-07 Thread Juerd
Ashley Winters skribis 2005-10-06 19:30 (-0700): > > my Array $a = 97; # dies eventually, but when? > Runtime -- cannot coerce Int value to Array It is fully determinable at compile time. 97 will never be compatible with Array, so I see no reason to wait. Do remember that some programs r

Re: Type annotations

2005-10-07 Thread Juerd
Yuval Kogman skribis 2005-10-07 3:02 (+0200): > > my Array $a = 97; # dies eventually, but when? > > my Int $b = 3.1415; # dies at all? > Both die at compile time, because the user explicitly contradicted > him/herself. This is like saying > my int = $x :: float; For my Int

Re: Type annotations

2005-10-06 Thread Ashley Winters
On 10/6/05, Luke Palmer <[EMAIL PROTECTED]> wrote: > So we're in line one of a Perl program, with static typing/inference > disabled (or at least inference *checking* disabled; perl may still > use it for optimization). When do the following die: compile time > (which includes CHECK time), run tim

Re: Type annotations

2005-10-06 Thread Yuval Kogman
On Thu, Oct 06, 2005 at 17:44:10 -0600, Luke Palmer wrote: > Autrijus convinced me that we have to really nail down the semantics > of type annotation without "use static". Let's first nail down what > I meant by "semantics" in that sentence. Basically, when do various > things get checked? Run