Re: static types, checking, conversions

2008-04-17 Thread TSa
HaloO, Larry Wall wrote: On Wed, Apr 16, 2008 at 04:29:23PM +, [EMAIL PROTECTED] wrote: : my Dog $spot = .new(); : : to : : my $Spot = Dog.new(); : : when you remove the declaration. You'd also break multiple dispatch rather badly... Sorry, why that? Isn't the dispatch on the dynamic

Re: Chained Comparisons ?

2008-04-17 Thread TSa
HaloO, John M. Dlugosz wrote: Any strong feeling about order-of-evaluation issues? And short-circuiting of the implicit and. I think f() g() h() is re-written by the compiler as f() ($temp = g()) $temp h(). Note that C# defines the order of evaluation as strictly left to right. And I

Does STD.pm handle this?

2008-04-17 Thread John M. Dlugosz
sub GetType (--Type) { ... } my ::RunTimeType := GetType; This is clearly permitted by the prose, that ::x may be bound to any object that does the Abstraction role, such as a typename, package, module, class, role, grammar, or any other protoobject with .HOW hooks. But the syntax might

Re: Returning Arrays?

2008-04-17 Thread TSa
HaloO, John M. Dlugosz wrote: Variance? Yeah, the standard set of co-, contra-, in- and bivariance ;) Assume A : B being subtypes. Then how should Foo[A] and Foo[B] relate? Foo[A] : Foo[B] # covariance Foo[B] : Foo[A] # contravariance Invariance means there's no relation at all.

Re: Does STD.pm handle this?

2008-04-17 Thread TSa
HaloO, John M. Dlugosz wrote: sub GetType (--Type) { ... } my ::RunTimeType := GetType; I think my declares value variables which means you need a sigil: my ::RunTimeType $ := GetType; and of course you capture the runtime type of the return value of GetType. If you write that as

Questions about design of perl, parrot

2008-04-17 Thread Miller, Hugh
Is there something for perl analogous to the sort of formal presentation seen in e.g., Robin Milner's Definition of Standard ML ? Is there any confluence between things perl and things found in the literature on partial evaluation (e.g., John Launchbury's thesis, papers etc.) ? Thanks! - Hugh

Re: Chained Comparisons ?

2008-04-17 Thread Patrick R. Michaud
On Wed, Apr 16, 2008 at 11:19:33PM -0400, Bob Rogers wrote: Pardon a lurker, but I'm not sure I understand the point of this. In: if $x $y $z { ... } I would expect a sensible compiler short-circuit the $x $y part, and indeed the Chained comparisons section of S03 (version 135)

Re: Generic Parameter Proposal

2008-04-17 Thread TSa
HaloO, John M. Dlugosz wrote: First, consider the stated examples for Generic type parameters, from the passage which defines the terminology in S02: I fear we need a rigorous definition of generic first. sub max (Num ::X @array) { push @array, X.new(); } Here you have a nice

Re: static types, checking, conversions

2008-04-17 Thread TSa
HaloO, Mark J. Reed wrote: Type checking in both js2/ecma4 and p6 is not merely documentation. It is enforced, but only if present. This is a tricky thing to achieve, which is why I suggested reading the js stuff to see how they went about it. I like the 'like' operator that does a

Re: static types, checking, conversions

2008-04-17 Thread TSa
HaloO, [EMAIL PROTECTED] wrote: You should look at Common Lisp. it's definition of optional typing is that if you take a correct program and remove all the type declarations, then it still works correctly, although it may be significantly less efficient. Larry and i have discussed this and

Re: static types, checking, conversions

2008-04-17 Thread Larry Wall
On Thu, Apr 17, 2008 at 09:24:47AM +0200, TSa wrote: HaloO, Larry Wall wrote: On Wed, Apr 16, 2008 at 04:29:23PM +, [EMAIL PROTECTED] wrote: : my Dog $spot = .new(); : : to : : my $Spot = Dog.new(); : : when you remove the declaration. You'd also break multiple dispatch rather

Re: Help understanding syntax in S06 Pairs as lvalues

2008-04-17 Thread Larry Wall
On Sun, Apr 13, 2008 at 09:00:08PM -, John M. Dlugosz wrote: : : :(:who($name), :why($reason)) := (why = $because, who = me); : : What do the symbols $name and $reason refer to? Are they names already in scope? That would be the intent, yes. Mind you, it seems like something only a crazy

Re: Chained Comparisons ?

2008-04-17 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: Why the complicated sig? Note that the left sequential definition enforces that ($a + $b) + $c dispatches to a version of + with the return type of the lhs addition. That is you need lots of overloaded versions of listfix +. Nonetheless I would

Re: Returning Arrays?

2008-04-17 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, John M. Dlugosz wrote: Variance? Yeah, the standard set of co-, contra-, in- and bivariance ;) Assume A : B being subtypes. Then how should Foo[A] and Foo[B] relate? Foo[A] : Foo[B] # covariance Foo[B] : Foo[A] #

Re: Does STD.pm handle this?

2008-04-17 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: I guess not. But ::Newname ::= OldTypeName; should work. The type system is a runtime overlay to the value system. This is reflected in the source by putting types and values into different syntactic slots. You cannot mix these! But

Re: Generic Parameter Proposal

2008-04-17 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: Which is no problem if ::T defines it in the lexical scope. Any outer definition is hidden. I guess re-using ::T in the same scope again for capturing a new type is an error. Just like redeclaring a value variable. BTW is You appear to be saying

Re: Chained Comparisons ?

2008-04-17 Thread Bob Rogers
From: Patrick R. Michaud [EMAIL PROTECTED] Date: Thu, 17 Apr 2008 07:22:20 -0500 On Wed, Apr 16, 2008 at 11:19:33PM -0400, Bob Rogers wrote: . . . but IIUC and is not short-circuiting. and is short-circuiting. Aha. I was misled by the presence of andthen, and was too sure of

Re: Returning Arrays?

2008-04-17 Thread Ilmari Vacklin
On Thu, Apr 17, 2008 at 03:41:06PM -0500, John M. Dlugosz wrote: The multi-dictionary search didn't show this usage of covariance and contravariance. But the series of articles on Type Theory in JOT uses it to mean in the same direction and in the opposite direction but doesn't define