Re: static types, checking, conversions

2008-04-16 Thread TSa
HaloO, Mark J. Reed wrote: It would behoove @Larry to examine the optional type constraints system proposed for Javascript:TNG (see link from firefox.com developers page). I therefore assume that they have done so, but others would benefit by doing likewise. :) Do I get that right: you imply

Chained Comparisons ?

2008-04-16 Thread John M. Dlugosz
I know how comparisons are chained in Perl 6. There is a very short section on it in S03. So, are the operators infix:{''} etc. written in the normal way to take two arguments? Then the language transforms A op B op C into A op B AND B op C on an innate level. Does that apply to any

Re: static types, checking, conversions

2008-04-16 Thread John M. Dlugosz
Thom Boyer thom-at-boyers.org |Perl 6| wrote: Mark J. Reed wrote: It would behoove @Larry to examine the optional type constraints system proposed for Javascript:TNG (see link from firefox.com developers page). I therefore assume that they have done so, but others would benefit by doing

Returning Arrays?

2008-04-16 Thread John M. Dlugosz
How do you declare a function that returns an array? Something like sub foo (blah) is Array of X { ... } seems right, but it has two problems. First is a real problem, and is a mistake seen a lot in C# and the .NET framework. A concrete type is used when it should be an interface. What

Re: static types, checking, conversions

2008-04-16 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: I found two dissertations and a couple of papers about typing JavaScript. The quintessential is that optional typing is defined as having *no* impact on the dynamic behavior of the program. In that respect type annotations are like comments. I

Re: Returning Arrays?

2008-04-16 Thread TSa
HaloO, John M. Dlugosz wrote: How do you declare a function that returns an array? Something like sub foo (blah) is Array of X { ... } The 'is' there is your invention, isn't it? The synopsis require 'of' or 'returns' depending if you want to specify the outer and/or inner type. The 'is'

Re: Chained Comparisons ?

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 3:49 , John M. Dlugosz wrote: Or, are the operators written in a tricky way, to return an object that encapsulates the original right argument and the proper boolean result, and has forms to take this object as well? IOW, no built-in support. Yes, they use

Re: Chained Comparisons ?

2008-04-16 Thread Patrick R. Michaud
On Wed, Apr 16, 2008 at 07:49:48AM -, John M. Dlugosz wrote: I know how comparisons are chained in Perl 6. There is a very short section on it in S03. So, are the operators infix:{''} etc. written in the normal way to take two arguments? Then the language transforms A op B op C

Re: static types, checking, conversions

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 3:44 , TSa wrote: I found two dissertations and a couple of papers about typing JavaScript. The quintessential is that optional typing is defined as having *no* impact on the dynamic behavior of the program. In that respect type annotations are like comments. I doubt that

Re: Returning Arrays?

2008-04-16 Thread TSa
HaloO, John M. Dlugosz wrote: I seem to recall seeing sigils in a signature without names, but now I can't remember where. E.g. in S06 und section The want function. Regards, TSa. -- The unavoidable price of reliability is simplicity -- C.A.R. Hoare

Re: static types, checking, conversions

2008-04-16 Thread Mark J. Reed
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. On 4/16/08, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Apr 16,

Re: cross operator and empty list

2008-04-16 Thread TSa
HaloO, Larry Wall wrote: Then [X]() also is ()? How about (0,1) X ([]) === (0,1)? No, that's (0,[]), (1,[1]). [] *doesn't* flatten in list context. I guess you meant (0,[]), (1,[]). And you didn't answer what [X]() returns. Following your arguments this would be undef. I am genuinely

Re: static types, checking, conversions

2008-04-16 Thread mark . a . biggar
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 that was his goai in Perl. Now

Re: static types, checking, conversions

2008-04-16 Thread Larry Wall
On Wed, Apr 16, 2008 at 04:29:23PM +, [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.

Re: Parrot 0.6.1 Bird of Paradise Released

2008-04-16 Thread François Perrad
2008/4/15 jerry gay [EMAIL PROTECTED]: Aloha! On behalf of the Parrot team, I'm proud to announce Parrot 0.6.1 Bird of Paradise. Parrot (http://parrotcode.org/) is a virtual machine aimed at running all dynamic languages. The Windows setup is available on

Re: Returning Arrays?

2008-04-16 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, John M. Dlugosz wrote: How do you declare a function that returns an array? Something like sub foo (blah) is Array of X { ... } I meant of, not is. In general the of keyword instanciates parametric types just like the direct

Re: Returning Arrays?

2008-04-16 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, John M. Dlugosz wrote: I seem to recall seeing sigils in a signature without names, but now I can't remember where. E.g. in S06 und section The want function. Regards, TSa. Somewhere else, I think it discussed unnamed parameters to

Re: Chained Comparisons ?

2008-04-16 Thread John M. Dlugosz
Patrick R. Michaud pmichaud-at-pobox.com |Perl 6| wrote: It applies to any operator that has 'chain' associativity -- see S06, Subroutine traits. If I want to make my own chained operator, perhaps the curvy #8828;, #8829;, etc. or make my operator #8807; a synonym for =, how would I tell

Re: Chained Comparisons ?

2008-04-16 Thread Larry Wall
On Wed, Apr 16, 2008 at 09:39:52AM -0400, Brandon S. Allbery KF8NH wrote: On Apr 16, 2008, at 3:49 , John M. Dlugosz wrote: Or, are the operators written in a tricky way, to return an object that encapsulates the original right argument and the proper boolean result, and has forms to take

Re: Chained Comparisons ?

2008-04-16 Thread Bob Rogers
From: Brandon S. Allbery KF8NH [EMAIL PROTECTED] Date: Wed, 16 Apr 2008 09:39:52 -0400 . . . Yes, they use multiple-typed values such that (3 5) returns (5 but True), which used in a numeric context is a 5 that can be chained with further infix:{''}s but in a boolean

Re: Chained Comparisons ?

2008-04-16 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: Well, that's more or less how Icon does it, but we're not going to expose anything like that to the user. If we assume that comparisons take two immutable objects, we can leave it to the compiler to compute the actual value once, and then feed it to

Generic Parameter Proposal

2008-04-16 Thread John M. Dlugosz
First, consider the stated examples for Generic type parameters, from the passage which defines the terminology in S02: sub max (Num ::X @array) { push @array, X.new(); } sub compare (Any ::T $x, T $y) { return $x eqv $y; }

Desk check this code please

2008-04-16 Thread John M. Dlugosz
Is this code syntactically and conceptually correct? method postfix:++ (--::?CLASS) is export { my ::?CLASS $temp = self; self =. successor; return $temp; } method prefix:++ (--::?CLASS) is export is rw { self =.successor; return self; } In particular, are pre/postfix