Re: Avoid the Yen Sign [Was: Re: new sigil]

2005-10-23 Thread Autrijus Tang
Dan Kogai wrote: > To make the matter worse, there are not just one "yen sign" in Unicode. > Take a look at this. > > ¥ U+00A5 YEN SIGN > ¥ U+FFE5 FULLWIDTH YEN SIGN > > Tough they look and groks the same to human, computers handle them > differently. This happened when Unicode Consortium decided

Re: new sigil

2005-10-21 Thread Autrijus Tang
Juerd wrote: > I do not see why $ and @ couldn't be both a sigil and an infix > operator, and the same goes for whatever ASCII equivalent ¢ gets. > > ^ and | are available for sigil use. (All the closing brackets are too, > but that would be very confusing because we tend to visually parse those >

Re: Complex types

2005-10-12 Thread Autrijus Tang
Larry Wall wrote: On Thu, Oct 13, 2005 at 09:43:15AM +1300, Sam Vilain wrote: : Hi all, : : Is it intentional that S09 lists unboxed complex types, but equivalent : Boxed types are missing from the "Types" section in S06? Nope. As it's a trivial omission, I went ahead and changed S06.pod (r6

Re: A listop, a block and a dot

2005-10-05 Thread Autrijus Tang
Luke Palmer wrote: With parentheses: print((length "foo") < 4) print(3 < 4) So this was quite a disturbing bug. This is now also quite a fixed bug. :-) However: f:{1}.() still parses as (&f(:{1})).() as the "adverbial block" form takes precedence. Is that also wro

Re: FYI: Lambda Calculus on Perl 6

2005-09-04 Thread Autrijus Tang
On Mon, Sep 05, 2005 at 12:35:36PM +0900, Dan Kogai wrote: > And I found that these can be made much, much simpler and more > intuitive with Perl 6, even more so than scheme! > > our $ZERO = sub($f){ sub($x){ $x }}; > our $SUCC = sub($n){ sub($f){ sub($x){ $f.($n.($f)($x)) }}}; > our $ADD

Re: Who is @Larry?

2005-08-25 Thread Autrijus Tang
On Thu, Aug 25, 2005 at 09:25:30PM -0400, Matt Fowles wrote: > I have a simple question. Who comprises @Larry? I am fairly sure > that I know a few people in it, but I am highly doubtful that I know > all of them. dev.perl.org has a "Who's Who" list: http://dev.perl.org/perl6/people.html T

Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Fri, Aug 19, 2005 at 01:36:30AM +0800, Autrijus Tang wrote: > BEGIN { > &foo := a Sub is stub { > ($a) := &?Internals::GETARGS(); > $a = 1 unless exists $a; > # real body begins here > ... > }; > } Er,

Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:26:00AM -0700, Larry Wall wrote: > Sure. Though it probably also wants to stay as metadata associated > with the signature, since part of the reason for putting it in > the signature in the first place is so that optimizers can install > constants on the caller end, at l

Re: Serializing code

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 08:22:20PM +0300, Yuval Kogman wrote: > > sub foo { $?DOM.document.write(...) } > > BEGIN { foo() }; # error, there's no $?DOM object > ># at compile-time! > > Unless you're compiling in the browser ;-) Which... is possible, and that's

Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Fri, Aug 19, 2005 at 01:15:23AM +0800, Autrijus Tang wrote: > On Thu, Aug 18, 2005 at 10:09:16AM -0700, Larry Wall wrote: > > In other words, you could desugar > > > > sub foo ($a = 1) {...} > > > > to > > > > s

Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:09:16AM -0700, Larry Wall wrote: > In other words, you could desugar > > sub foo ($a = 1) {...} > > to > > sub foo ($a) { > $a = 1 unless exists $a; > ... > } I like this. Can we go for it, at least for this week? :) Thanks, /Autrijus/ pgp7

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:02:23AM -0700, chromatic wrote: > On Wed, 2005-08-17 at 23:43 -0500, Dave Rolsky wrote: > > > But I'd really like to get this stuff done at compile time wherever > > possible. If I write this: > > > >validate( credit_card_number: $number ); BTW, the colon is on t

Re: Serializing code

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 12:24:40PM +, Ingo Blechschmidt wrote: > >- closures? > A subclass of Code, e.g. Bare. There is no Bare anymore: Code - Routine - Block Thanks, /Autrijus/ pgpyGJA7hqKo5.pgp Description: PGP signature

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote: > And another question. How will I make Perl6 not do automatic coercion for > me. If I have this sub: > > sub date (Int +$year is required, +$month, +$day) BTW, Pugs supports the ++ syntax, which iirc is said to be back in favour du

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote: > On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: > : 1.e5# all of these... > : 1._e5 # > : 1._0e5 # > : 1.e_0_5_# == 1 * 10^5? > > The last three are illegal because underline is allowed

Re: my $pi is constant = 3;

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 08:47:18AM -0700, Larry Wall wrote: > : >That could be made to work by defining constant to mean you can assign > : >to it if it's undefined. But then it gets a little harder to reason > : >about it if $pi can later become undefined. I suppose we could > : >disallow undefi

Re: Generic classes.

2005-08-16 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 11:07:51AM -0700, Larry Wall wrote: > Sure, except that you're not really inheriting from a role here. > You're really inheriting from an anonymous class of the same name. :-) Hmm, "Anonymous class with the name 'Array of Any'" sounds like an oxymoron. Also consider:

Re: Time::Local

2005-08-16 Thread Autrijus Tang
On Tue, Aug 16, 2005 at 08:37:24AM -0700, Larry Wall wrote: > : But that's in contrast to your saying that the epoch would be December 31, > : 1999 at 23:59:29.0 UTC. Or did I misread your earlier messages? > > Yes, you misread it. I was angling for 00:00:00.0 UTC. But it scarcely > matters if

Type inferencing for Perl5

2005-08-16 Thread Autrijus Tang
On Tue, Aug 16, 2005 at 02:04:41PM +0100, Nicholas Clark wrote: > On Thu, Aug 11, 2005 at 01:35:14AM +0800, Autrijus Tang wrote: > > On Wed, Aug 10, 2005 at 07:32:01PM +0200, TSa wrote: > > > Counting the sigil quadriga as 4, what is the fifth element? > > & @ $ % ::

Re: Generic classes.

2005-08-15 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 10:43:45AM -0700, Larry Wall wrote: > : So the last line means a role can be used just like a class, and > : _inherit_ its behaviour as well? > : > : role Point { has $.x; has $.y; method move_right { $.x++ } }; > : role MyPoint is Point { > : method move_right

Re: Generic classes.

2005-08-15 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 08:19:38AM -0700, Larry Wall wrote: > I think the distinction is still useful to document that there are > still unbound types. What we need to emphasize is that a role can be > used as a class, at which point any unbound types are bound to Any, > or whatever we're calling

Generic classes.

2005-08-14 Thread Autrijus Tang
S06 made many explicit uses of generics as classes, which I find difficult to reconcile with the "only roles takes type parameter" ruling. For example: my Hash of Array of Recipe %book; my Hash[returns=>Array[returns=>Recipe]] %book; And later: class LoudArray is Array { ... } Clea

Re: my $pi is constant = 3;

2005-08-11 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 12:41:17PM -0700, Larry Wall wrote: > : If yes, what does it desugar to? > : > : my $pi is constant := 3; > : my $pi is constant ::= 3; > > In this case it desugars to > > my $pi is constant = 3; > > :-) However, I wonder if the intention was to replace the

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 09:22:27AM -0700, Larry Wall wrote: > On Thu, Aug 11, 2005 at 10:47:35AM +0800, Autrijus Tang wrote: > : Adding inference ("is typed") to the mix massively sweetens the first > : option, which would be a good thing. > > Only if the programmer ca

Re: Classes as special undefs

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 04:47:49PM +0200, TSa wrote: > OK, let's play some manual type inferencing ;) Note that $spot here is intended to be dynamic typed, i.e. not subject to inference. :-) > >my $spot = Dog; > > $spot.does(Item of Dog), that means what ever the name Dog represents > was s

Re: Classes as special undefs

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 08:53:47PM +1000, Stuart Cook wrote: > On 11/08/05, Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> wrote: > > One that you missed was that this syntax: > > > >my Dog $spot .=new(); > > > > Falls out of it quite naturally. > > Actually I tried to mention that indirectly,

Re: Typed type variables (my Foo ::x)

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 08:02:00PM +1000, Stuart Cook wrote: > What's the current meaning of type annotations on type-variables? > > For example, if I say... > > my Foo ::x; > > ...which of these does it mean? > > a) ::x (<=) ::Foo (i.e. any type assigned to x must be covariant wrt. Foo) >

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:31:40PM +0200, TSa wrote: > >my $x is typed; > >$x = "123"; > >$x = length($x); > > > >Would be a type error. If it's in the dynamic world (as in Perl5), > >that's just fine. Does that difference make sense to you? > > The question remains, when exactly doe

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 09:29:38PM +0200, TSa wrote: > >Finally, it would get tedious to write them out by hand. So a lexical > >"traits" pragma may help: > > > >{ > > # Entering the realm of referential transparency... > > use traits < defined typed constant >; > > my $x; # autom

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 11:24:05AM -0700, Larry Wall wrote: > : My current understanding is that the typechecker considers IO to be of > : Class type, not of IO type; the fact that IO.does(IO) is true is purely > : an illusion created by special dispatch for .does. > > Well, that's what I thought

Re: $obj.meta.add_method('foo' => ???)

2005-08-10 Thread Autrijus Tang
On Tue, Aug 09, 2005 at 06:32:52PM -0400, Stevan Little wrote: > Now I realize that in perl 6 you can re-open classes and add methods to > them. However this is not convenient for programmatic class generation. Because of string eval, you mean? Well, some quasiquoting should fix that, but let's

my $pi is constant = 3;

2005-08-10 Thread Autrijus Tang
According to S06: my $pi is constant = 3; Is this a special form? If yes, what does it desugar to? my $pi is constant := 3; my $pi is constant ::= 3; If not a special form, should this work? my $pi is constant; $pi = 3; If yes, should this pass compilation? my $pi i

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 07:32:01PM +0200, TSa wrote: > you wrote: > >Perl 6 in its unannotated form is also (mostly) a typeless languages, > >with only the five builtin types, much like Perl 5 is. > > Counting the sigil quadriga as 4, what is the fifth element? & @ $ % :: In Perl5, :: is replac

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:25:05AM -0700, Larry Wall wrote: > I'll have to think about the rest of your proposal, but I was suddenly > struck with the thought that our "platonic" Class objects are really > forms of undef: > > say defined IO; # prints 0 Hmm, bool::false stringifies to '0'? Al

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:12:45AM -0700, Larry Wall wrote: > We can get away with this in Perl 6 because bindings to positionals > happen lazily. So all we have to check for syntactically is that we > don't have a subsequent declaration that changes the syntax from list > to unary (or none-ary).

Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
So I'm starting to write the inferencer. Immediately I encounter the problem that every type can potentially contain "undef": my IO $x = open('/etc/passwd'); $x = undef; $x.close; This raises the runtime error: *** Can't call method "close" on an undefined value. The "undef" li

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 06:03:18AM -0600, Luke Palmer wrote: > On 8/10/05, Autrijus Tang <[EMAIL PROTECTED]> wrote: > > But it's an toplevel optimization, which is not applicable to > > module authors. So I'd very much welcome a lexical pragma that > > forc

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:47:47AM +0200, Juerd wrote: > Larry Wall skribis 2005-08-09 16:19 (-0700): > > So either something in the context tells us what "Foo" means, or > > it will be taken as a list operator that hasn't been declared yet. > > Is there, by the way, a pragma to force predeclarati

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-09 Thread Autrijus Tang
On Tue, Aug 09, 2005 at 06:36:28PM +0200, TSa wrote: > But Smalltalk is a typeless language that dispatches along the lines > of the (meta)class/(meta)object links. I propose to call this kind > of thing slot dispatch and reserve single and multi method dispatch for > the type based approach. Don't

Re: Container model - pictures and questions

2005-08-09 Thread Autrijus Tang
On Tue, Aug 09, 2005 at 02:06:58PM +0200, TSa wrote: > >The first one is about the compilation cycle: > > > >http://pugscode.org/images/simple-compilation.png > > Question: where is the namespace in the picture? > I would expect it to be build in parallel to the > syntax tree between parser an

Re: Container model - pictures and questions

2005-08-08 Thread Autrijus Tang
On Mon, Aug 08, 2005 at 06:04:51PM +0200, "TSa (Thomas Sandla�)" wrote: > Autrijus Tang wrote: > >If I'm mistaken, please let me know, preferably by suggesting > >new arrangements on the diagram. :-) > > Without judging your mistakes, here are my comments t

Re: The meaning of "returns"

2005-08-06 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 03:52:41PM +0200, "TSa (Thomas Sandla�)" wrote: > >And this is a natural extension to guide the inferencer so it won't be > >totally giving up on polymorphic functions such as &id. C) and D) can > >be taken together, resulting to a powerful soft typed language. > > This is

Container model - pictures and questions

2005-08-06 Thread Autrijus Tang
(Cc'ing p6l, but this feels like a p6c thread...) Greetings. As I'm moving forward with the new PIL runcore, I'm now trying to document my understanding as visual diagrams. The first one is about the compilation cycle: http://pugscode.org/images/simple-compilation.png The second one is abo

Re: Unable to run perl 6 test under Parrot 0.2.x

2005-08-05 Thread Autrijus Tang
On Sat, Aug 06, 2005 at 01:51:17AM +0400, Andrew Shitov wrote: > > Parrot 0.2.3 "Serenity" Released! > > Possibly I'm growling again but I cannot run any Perl 6 programme with > new Parrots. > > One-liner test.p6 containing 'print "perl 6";' is compiled to test.imc and > cause an error: The REA

Re: Complete type inferencing

2005-08-01 Thread Autrijus Tang
On Tue, Aug 02, 2005 at 12:49:06PM +1000, Brad Bowman wrote: > > 1. Asserted > > > > The usual case for Perl 6 functions, due to its default "Item" > > signature for parameters. In the example below, I assume that ::* > > cannot > > be changed freely to do away with ::*IO at runtime.

Re: sub foo ($x) returns ref($x)

2005-08-01 Thread Autrijus Tang
On Mon, Aug 01, 2005 at 03:16:50PM +0200, "TSa (Thomas Sandla�)" wrote: >sub equitype ( ::a $x, a $y) { ... } That's not a bad idea at all. I rather like it. I'd just still like an explicit type-unifying parens around ::a, just so people won't say sub foo (::Int $x) { ... } and acciden

Eliminating &{} and *{}

2005-07-31 Thread Autrijus Tang
Under my current design of containers (see "definition of containers" on p6c), there are only Scalar, Array and Hash containers. This is in accordance to them being the only first-class data structures that deals with mutable data storage. This is similar to JVM's division between scalar data and

Re: Binding scalars to aggregates

2005-07-30 Thread Autrijus Tang
On Sat, Jul 30, 2005 at 09:40:11AM -0700, Larry Wall wrote: > Right, so I guess what really happens is ref autogeneration in that > case, and there's no difference between > > $x = @array; > $x := @array; > > Hey, who said anything about consistency? :-) Hm, not exactly. This form:

sub foo ($x) returns ref($x)

2005-07-30 Thread Autrijus Tang
Suppose we have a function that takes an argument and returns something with the same type as that argument. One previous suggestion is this: sub identity ((::a) $x) returns ::a { return(...) } This is fine if both invariants in the "the meaning of 'returns'" thread are observed, since the i

Re: Curious use of .assuming in S06

2005-07-29 Thread Autrijus Tang
On Fri, Jul 29, 2005 at 12:53:03PM -0700, Brent 'Dax' Royal-Gordon wrote: > Autrijus Tang <[EMAIL PROTECTED]> wrote: > > In S06's Currying section, there are some strange looking examples: > > > > &textfrom := &substr.assum

Curious use of .assuming in S06

2005-07-29 Thread Autrijus Tang
In S06's Currying section, there are some strange looking examples: &textfrom := &substr.assuming(:str($text) :len(Inf)); &textfrom := &substr.assuming:str($text):len(Inf); &woof ::= &bark:(Dog).assuming :pitch; Why is it allowed to omit comma between adverbial pairs, and even omit

Complete type inferencing

2005-07-29 Thread Autrijus Tang
On Fri, Jul 29, 2005 at 04:59:21AM +0800, Autrijus Tang wrote: > However, my intuition is that a soft-typed system, with clearly defined > dynamic parts translated to runtime coerce and dependent types, that can > work exactly as Perl 5 did at first, but provide sensible inferencing >

Re: Elimination of Item|Pair and Any|Junction

2005-07-28 Thread Autrijus Tang
On Fri, Jul 29, 2005 at 05:59:43AM +0800, Autrijus Tang wrote: > I can see marking things explicitly for named bindings: > > foo(:literal); > foo(*%nameds); > foo(*$pair); > foo([EMAIL PROTECTED]); Er, sorry, the last one should be foo(*%{ hash @list_of

Re: Elimination of Item|Pair and Any|Junction

2005-07-28 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 09:27:00AM -0700, Larry Wall wrote: > Or maybe Any really does mean "Object" and we're just viewing our > hierarchy too strictly if we make every relationship "isa". That's one > thing that neither this formulation nor Thomas's are making very > clear--which type relations

Some thoughts on PIL

2005-07-28 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 06:31:34PM +0200, "TSa (Thomas Sandla�)" wrote: > BTW, where can I read about PIL, other then in Parrot/Pugs svn? (Cc'ing in P6C.) The current type-indexed design of PIL is going away, because it is closely tied to the PIR/Parrot model, to the disadvantage of our Perl5/Jav

Inferring (Foo of Int).does(Foo of Any)

2005-07-27 Thread Autrijus Tang
As Perl 6's aggregate types are generics (Role that takes type parameters), the problem of type variancy naturally arises. The basic premise is that: 1. (Array of Item).does(Array of Int); # false 2. (Array of Int).does(Array of Item); # also false! Intuitively, while an (Array

Re: The meaning of "returns"

2005-07-27 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 05:57:28AM +0800, Autrijus Tang wrote: > On Thu, Jul 28, 2005 at 05:03:05AM +0800, Autrijus Tang wrote: > > Hence, it seems to me that there are only four ways out: > > Some annotations copied from discussion in #perl6: Last time I reply to myself

Re: The meaning of "returns"

2005-07-27 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 05:03:05AM +0800, Autrijus Tang wrote: > Hence, it seems to me that there are only four ways out: Some annotations copied from discussion in #perl6: > A) Omit the #3 check from compile time; at runtime, use the actual > type of $x. The "returns&qu

Re: Elimination of Item|Pair and Any|Junction

2005-07-27 Thread Autrijus Tang
On Thu, Jul 28, 2005 at 03:55:55AM +0800, Autrijus Tang wrote: > Hrm. I thought the original motivation of forcing people to write > > Any|Junction > > was precisely to discourage people from accidentally write > > sub foo (Any $x) > > and have $x accept

The meaning of "returns"

2005-07-27 Thread Autrijus Tang
Consider this: sub id (Any $x) returns Any { return($x) } sub length (Str $y) returns Int { ... } length(id("abc")); Under standard static subtyping rules, this call will perform three different typechecks: 1) "abc".does(Any) # ("abc" as Str) ===> (Any $x) in &id 2) $x.does(A

Re: Elimination of Item|Pair and Any|Junction

2005-07-27 Thread Autrijus Tang
On Wed, Jul 27, 2005 at 09:12:00AM -0700, Larry Wall wrote: > Yes. The only thing I don't like about it is that any() isn't an Any. > - Object > - Mumble > - Item > - ...pretty much everything > - Pair > - Junction > - num, int, str... Hrm.

Re: Elimination of Item|Pair and Any|Junction

2005-07-27 Thread Autrijus Tang
On Wed, Jul 27, 2005 at 12:19:10PM -0400, Matt Fowles wrote: > While we are talking about words... I dislike having Object encompass > Juction. I get the feeling that some people will write functions that > take Objects and not expect Junctions to slip in. I suppose that > could be one of those h

Elimination of Item|Pair and Any|Junction

2005-07-27 Thread Autrijus Tang
On Fri, Jul 22, 2005 at 03:40:34PM -0700, Larry Wall wrote: > I dunno. I'm inclined to say that it should default to Item|Pair, and > let people say Any explicitly if they really want to suppress autothreading. > Otherwise conditionals and switches are going to behave oddly in the > presence of "a

Re: Strange interaction between pairs and named binding

2005-07-18 Thread Autrijus Tang
On Mon, Jul 18, 2005 at 03:48:55PM -0700, Brent 'Dax' Royal-Gordon wrote: > Autrijus Tang <[EMAIL PROTECTED]> wrote: > > This currently works in Pugs: > > > > for [1..10].pairs -> Pair $x { say $x.value } > > > > But this does not

Strange interaction between pairs and named binding

2005-07-18 Thread Autrijus Tang
This currently works in Pugs: for [1..10].pairs -> Pair $x { say $x.value } But this does not: for [1..10].pairs -> $x { say $x.value } Because the ruling that pairs must not be bound to parameters that are not explicitly declared to handle them. Is this a desirable behaviour? Thanks,

Re: Type::Class::Haskell does Role

2005-07-15 Thread Autrijus Tang
On Sat, Jul 16, 2005 at 12:24:21AM +0300, Yuval Kogman wrote: > > There is a new generic comparison operator known as ~~. > > ~~ is just Eq, there is also Ord Hmm, <~ and ~> for generic comparators? ;) > and Show That is already prefix ~ for that. > and a multitude of other things, which are m

Re: WTF? - Re: method calls on $self

2005-07-14 Thread Autrijus Tang
On Thu, Jul 14, 2005 at 09:38:45PM +0200, Juerd wrote: > Nathan Gray skribis 2005-07-14 12:55 (-0400): > > Autrijus joked? about $?.method once (instead of ./method), in case we > > need any more bad alternatives for $?SELF.method. But I also trust > > @larry, or %larry, or even $larry, to make a

Re: Type::Class::Haskell does Role

2005-07-14 Thread Autrijus Tang
On Fri, Jul 15, 2005 at 02:38:22AM +0300, Yuval Kogman wrote: > As I see it == is the generic comparison, and 'eq' is == with > coercing parameters (in Haskell it'd be > eq :: (Show a) => a -> a -> Bool or so... Isn't that lovely?) There is a new generic comparison operator known as ~~. The dispa

Re: WTF? - Re: method calls on $self

2005-07-14 Thread Autrijus Tang
If this were a straw poll, I'd say... 1. Meaning of $_ .method should mean $_.method always. Making it into a runtime error is extremely awkward; a compile-time error with detailed explanataion is acceptable but suboptimal. 2. Topicalization of $?SELF Neutral on this -- I can a

Re: User-defined infix subs/methods?

2005-07-13 Thread Autrijus Tang
On Tue, Jul 12, 2005 at 02:10:06PM -0700, Larry Wall wrote: > Good, I'd forgotten about that. Which means that it's even harder > for someone to compile a module in a "strange" dialect, since they'd > essentially have to write their own version of "use" that forces > recompilation ("reuse", if you

Re: User-defined infix subs/methods?

2005-07-12 Thread Autrijus Tang
On Sat, Jul 09, 2005 at 03:58:45PM -0700, Larry Wall wrote: > It should take a little more effort to mess with the minds of > unsuspecting modules, so maybe the standard syntax is cloned out of > *STANDARD_PERL_6 or some such scary package name. It's the default for > starting all require-like Per

Re: How to write a self.pm (Re: method calls on $self)

2005-07-11 Thread Autrijus Tang
On Mon, Jul 11, 2005 at 09:04:54PM -0700, Larry Wall wrote: > On Tue, Jul 12, 2005 at 10:17:01AM +0800, Autrijus Tang wrote: > : On Mon, Jul 11, 2005 at 06:29:28PM -0700, Larry Wall wrote: > : The obvious thought is to have yet another magical, $^H like flag, to > : denote the current

How to write a self.pm (Re: method calls on $self)

2005-07-11 Thread Autrijus Tang
(Cross-posting the new ruling from p6l to p6c to discuss implementation strategy) On Mon, Jul 11, 2005 at 06:29:28PM -0700, Larry Wall wrote: > { > let $Larry.decisive = 1; > > Okay, this is what we're gonna do. We're gonna go back pretty close to > where we were originally, but wit

User-defined infix subs/methods?

2005-07-09 Thread Autrijus Tang
In Pugs's ext/Set/lib/Set.pm, there are a number of user-defined infix operators. To avoid unicode in mails, I'll use a hypothetical &infix:<===> as the operator name. Consider the sub case: class Set; sub infix:<===> (Set $x, Set $y) { ... } Is it correct that this line: Set.new =

Hackathon notes

2005-07-07 Thread Autrijus Tang
During the Pugs Hackathon at YAPC::NA 2005, I managed to get various unspecced tests and features reviewed by Larry, and posted them in my journal. The original notes is attached; I'd be very grateful if you or other p6l people can find tuits to work them back into the relevant Synopses. :-) Than

Type variables vs type literals

2005-06-29 Thread Autrijus Tang
Currently, does this: sub foo (::T $x, ::T $y) { } and this: sub foo (T $x, T $y) { } Means the same thing, namely a) if the package T is defined in scope, use that as the type constraint for $x and $y b) otherwise, set ::T to be the most immediate common supertype o

Re: Quasiquoting

2005-06-28 Thread Autrijus Tang
On Tue, Jun 28, 2005 at 01:19:20PM +1000, Adam Kennedy wrote: > >Yes... quasiquoting in Perl 5 is currently crudely emulated > >by feeding things to PPI::Tokenizer and PPI::Transform. :-) > > PPI is not a code parser. By code parser I mean taking a string and > turning it into working code. PPI i

Re: Quasiquoting

2005-06-27 Thread Autrijus Tang
On Tue, Jun 28, 2005 at 09:49:58AM +1000, Brad Bowman wrote: > Autrijus' journal mentions quasiquoting (Perl 5). Yes... quasiquoting in Perl 5 is currently crudely emulated by feeding things to PPI::Tokenizer and PPI::Transform. :-) > I was wondering how that would work. Many languages use unusu

scalar dereferencing.

2005-06-16 Thread Autrijus Tang
my $x = 3; my $y = \$x; say $y + 10; $y++; say $y; say $x; Currently in Pugs they print: 13 4 3 Is this sane? What is the scalar reference's semantics in face of a stringification and numification? I assume that array/hash references simply pass on to the t

sub my_zip (...?) {}

2005-06-16 Thread Autrijus Tang
Currently in Pugs &*zip has no signature -- it simply rewrites its arguments into the listfix ¥ (i.e. Y) function. That is bad because it can't be introspected, and you can't define something like that yourself. It also makes it uncompilable to Parrot as I don't control the runloop there. :) Als

Re: PATCH: S04 - unary C<=> is not slurpy

2005-06-15 Thread Autrijus Tang
On Wed, Jun 15, 2005 at 05:37:18PM -0500, Patrick R. Michaud wrote: > Based on an off-list discussion, it turns out that unary C<=> > is not slurpy as mentioned in S04. The following patch to S04 > corrects this; I've already applied the patch but thought I'd > pass it by p6l for review/comments/r

Re: BEGIN {...} and IO

2005-06-13 Thread Autrijus Tang
On Mon, Jun 13, 2005 at 10:48:47AM -0700, chromatic wrote: > > # Problem; > > my $fh = BEGIN { open "some_file" err... }; > > # Compile-time filehandle leaked into runtime! > > say =$fh; > > Perhaps I'm being very naive, but why is this a problem? Maybe it's not > the best way to do somet

Re: How much do we close over?

2005-06-12 Thread Autrijus Tang
On Mon, Jun 13, 2005 at 12:57:32AM +0200, Chip Salzenberg wrote: > On Sun, Jun 12, 2005 at 11:26:49PM +0100, Piers Cawley wrote: > > sub foo { my $x = 1; return sub { eval $^codestring } } > > say foo()("$x"); > > I'm pretty sure you meant single-quoted, and you perhaps might maybe > need

Syntax of using Perl5 modules?

2005-05-24 Thread Autrijus Tang
So, this now works in Pugs with (with a "env PUGS_EMBED=perl5" build): use Digest--perl5; my $cxt = Digest.SHA1; $cxt.add('Pugs!'); # This prints: 66db83c4c3953949a30563141f08a848c4202f7f say $cxt.hexdigest; This includes the "Digest.pm" from Perl 5. DBI.pm, CGI.pm etc will

Re: Perl development server

2005-05-23 Thread Autrijus Tang
On Mon, May 23, 2005 at 05:25:57PM +0200, Juerd wrote: > > dev.pugscode.org seems indicated ... > > Sorry, but 'dev' isn't cute enough :). And it's going to be > something.perl6.nl, probably. I don't mind aliases, though, but they > better be CNAMEs. How about dev.perl6.nl -- I'll CNAME dev.pugsc

Re: foo(1: 2: 3: 4:) ?

2005-05-22 Thread Autrijus Tang
On Mon, May 23, 2005 at 12:38:14PM +1000, Damian Conway wrote: > >Err, wait. From S06: > > > ># Indirect multimethod call... > >handle_event $w, $e: $m; > > > >Is this single-dispatch? > > No. I think it's vestigial (or ought to be). Luke's argument against colons > in multimethod calls

Re: foo(1: 2: 3: 4:) ?

2005-05-22 Thread Autrijus Tang
On Mon, May 23, 2005 at 11:07:59AM +1000, Damian Conway wrote: > >Hmm, I'm doubting that reflecting how many invocants you have on the > >caller side is a good idea. It seems awfully brittle in the face of > >reimplementation. > > Yep. And that's precisely why we previously ruled against colons i

Re: foo(1: 2: 3: 4:) ?

2005-05-22 Thread Autrijus Tang
On Fri, May 20, 2005 at 03:23:51PM +0800, Autrijus Tang wrote: > So I'm finally starting to implement multi-level invocants in MMDs. > I'd like to sanity check some cases first, though. Hmm, Warnocked? I'll assume this is sane, until told otherwise, then.

foo(1: 2: 3: 4:) ?

2005-05-20 Thread Autrijus Tang
So I'm finally starting to implement multi-level invocants in MMDs. I'd like to sanity check some cases first, though. Are these two assumed to be identical? multi sub foo ($x, $y) multi sub foo ($x, $y : ) But these two are _not_ identical? multi sub foo ($x : $y : $z) multi su

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 02:45:58PM +, Luke Palmer wrote: > Just for the folks not following along on IRC, I don't think I implied > that. But Autrijus apparently inferred it :-). My apologies. It's a misparse on my part. > Anyway, there is no MMD whatsoever on the final level, so that: > >

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 07:26:54AM -0700, Larry Wall wrote: > It does seem that the signature that provides more information should > be "rewarded" for that somehow. Maybe it's most useful if non-invocant > args (or non-invocant-YET args, in this case) are just considered to > be at "Any" distance

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 07:00:23AM -0700, Larry Wall wrote: > On Tue, May 17, 2005 at 01:50:48PM +, Luke Palmer wrote: > : Is that still the case? I don't recall us getting rid of it, but it > : doesn't seem to be documented in the AES. > > We didn't get rid of it. So does it mean that a "3-

Quick question: '1.28' * '2.56'

2005-05-17 Thread Autrijus Tang
Imagine: pugs> '1.28' * '2.56' 3.2768 What is (or should be) going on here here? [1] role NumRole { method infix:<*> returns Num (NumRole $x, NumRole $y: ) { ... } } Str.does(NumRole); [2] multi sub infix:<*> (Str $x, Str $y) returns Num { ... } [3] multi sub prefix:<+>

Re: not 4,3,2,1,0;

2005-05-16 Thread Autrijus Tang
On Mon, May 16, 2005 at 04:06:15PM -0700, Larry Wall wrote: > That's > > sub not (*args is context(Scalar)) > > or whatever we end up calling the Any/Scalar type. How about is context(Item) versus is context(Slurpy). :) Also, shouldn't the *args there be [EMAIL PROTECTED] Is it really okay

Re: not 4,3,2,1,0;

2005-05-16 Thread Autrijus Tang
On Mon, May 16, 2005 at 12:49:13PM -0700, Larry Wall wrote: > On Tue, May 17, 2005 at 01:48:20AM +0800, Autrijus Tang wrote: > : This evaluates to 1 in Perl 5: > : > : not 4,3,2,1,0; > : > : Namely, the "not" listOp is taking the last of a variadic, non-slurpy &

not 4,3,2,1,0;

2005-05-16 Thread Autrijus Tang
This evaluates to 1 in Perl 5: not 4,3,2,1,0; Namely, the "not" listOp is taking the last of a variadic, non-slurpy argument list, boolify it, and return its negation. What is the Perl 6 signature that correspond to this behaviour? Also, is this still sane for Perl 6's ¬? Thanks, /Autriju

Re: ./method

2005-05-15 Thread Autrijus Tang
On Sun, May 15, 2005 at 04:40:04PM +0200, Juerd wrote: > Because of that, it is probably better to go with ./method not have ../method Good. I was having a headache trying to convince myself ../method was a good idea, but can't. Thanks for delivering me. :) /Autrijus/ pgpPIwCGEgfd1.pgp Descri

Re: ./method

2005-05-15 Thread Autrijus Tang
On Sun, May 15, 2005 at 01:44:44PM +0200, Juerd wrote: > I suggest > ./method > to mean $?SELF.method > > Your opinions please! (I ask those who already responded off-list, to > repeat their opinion here) I like it. Tentatively implemented as r3253 for people to experiment with. The convert

Re: ^method ?

2005-05-15 Thread Autrijus Tang
On Sun, May 15, 2005 at 01:19:53PM +0200, Juerd wrote: > Or was your choice of words poor, and did you not mean to discuss the > dot's *default*, but instead a standard way to write the current > invocant? I think what Rob suggested is that: method ($foo) means method ($self: $foo) by

The [] metaoperator

2005-05-14 Thread Autrijus Tang
On Sat, May 14, 2005 at 10:56:29PM +1000, Damian Conway wrote: > 8. To verify the monotonicity of a sequence: > >$is_monotonic = [<] @numbers; Hey. Does this mean that the [] metaoperator folds with the associativity of the operator inside it? That is, if the operator inside is

  1   2   3   >