Re: Re(vised): Proposal to make class method non-inheritable

2005-10-15 Thread wolverian
On Sat, Oct 15, 2005 at 08:25:15AM -0700, Larry Wall wrote:
> [snip]
>
> Of course, there's never been any controversy here about what to call
> "self", oh no... :-)

IMHO just call it "self" (by default) and be done with it. :) 

-- 
wolverian, contributing to the general disagreement


Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread wolverian
On Sun, Sep 25, 2005 at 12:52:08PM +0200, Juerd wrote:
> Hackers on this list, what do you think?

I think separating the two is extremely confusing. I do not see any uses
for it, but maybe I am not thinking hard enough. 

-- 
wolverian


signature.asc
Description: Digital signature


.chars, .bytes, etc.

2005-09-24 Thread wolverian
Hi all,

After some thinking it occured to me that the current way of defining
.chars, .bytes and .elems (and whatever else there are) doesn't make any
sense to me. In pugs at least they currently return the amount of units
in question - in any context! Why not define .chars like this:

Context Return value
itemamount of units
listunits themselves

Juerd proposed this list originally, which matches my thinking.

Originally I thought that .elems and .chars were symmetric and both
should behave the same semantically, but now I think that's false - if
there should be an .elems method, leave it at returning an Int at all
times. @foo.elems returning the elements in @foo makes no sense.

-- 
wolverian


signature.asc
Description: Digital signature


Re: Zcode interpreter release

2005-08-24 Thread wolverian
On Tue, Aug 23, 2005 at 05:09:26PM -0400, Amir Karger wrote:
> testportal:~/z>perl -we 'system("cd y")'

The right thing to do (tm) here is chdir("y"), but if 'cd' is just an
example and not the actual command, the right thing is system LIST form:

system command => @args;

-- 
wolverian


signature.asc
Description: Digital signature


Re: File.seek() interface

2005-07-07 Thread wolverian
On Thu, Jul 07, 2005 at 05:58:53PM -0700, Larry Wall wrote:
> $fh.pos = $fh.pos + 10`lines

I'm sorry if this has been discussed, but is the ` going to be in
Perl 6? I like it. :) How does it work, though?

sub *infix:<`> (Num $amount, Unit $class) { $class.new($amount) }

Or so?

Now I'm tempted to make it a generic infix .new.

(args)`Class;

It's almost as confusing as SML!

-- 
wolverian


pgpv9c1yjpWKv.pgp
Description: PGP signature


Re: File.seek() interface

2005-07-07 Thread wolverian
On Thu, Jul 07, 2005 at 08:18:40PM +0300, wolverian wrote:
> I'm a pretty high level guy, so I don't know about the performance
> implications of that. Maybe we want to keep seek() low level, anyway.

Sorry about replying to myself, but I want to ask a further question on
this.

Would it be possible to make this work, efficiently:

for =$fh[-10 ...] -> $line { ... }

to iterate over the last ten lines?

Can we generalise that to be as performance-effective as seek()?

Okay, that was two questions.

-- 
wolverian


pgpeCev9cv0EX.pgp
Description: PGP signature


File.seek() interface

2005-07-07 Thread wolverian
Hello,

gaal is porting the Perl 5 filehandle functions to a Perl 6 OO
interface. The Perl 5 interface with global constants from Fcntl strikes
me as severely lacking in elegance and OO.

$fh.seek(-10, SEEK_END);

Instead of globals, how about a :from adverb?

$fh.seek(-10, :from);

Or maybe we don't need such an adverb at all, and instead use

$fh.seek($fh.end - 10);

I'm a pretty high level guy, so I don't know about the performance
implications of that. Maybe we want to keep seek() low level, anyway.

Subject to change when it comes to the Perl 6 Unicode semantics, of
course. :)

Any thoughts/decisions?

-- 
wolverian


pgpQSU1ZpXRB5.pgp
Description: PGP signature


Re: Transparent / Opaque references

2005-06-02 Thread wolverian
On Thu, Jun 02, 2005 at 10:45:45PM +0200, Juerd wrote:
> If we allow "sub .foo", "sub :foo" comes naturally, and another
> asymmetry is gone.
> 
> It would also allow "multi sub" and "multi method" to simply become
> "multi". 

I _really_ like the explicit 'method' name that methods have. Calling
them subs doesn't make sense to me.

-- 
wolverian


signature.asc
Description: Digital signature


Re: (1,(2,3),4)[2]

2005-05-25 Thread wolverian
On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote:
> please don't use <== for simple assignments as it will confuse too many
> newbies and auch. it (and its sister ==>) are for pipelining ops like
> map/grep and for forcing assignment to the slurpy array arg of funcs
> (hey, i think i said that correctly! :). = is still fine for basic
> assignment and everyone will understand it immediately.

I thought the op is visually so obvious it wouldn't need any
explanation, even for newbies.

Too bad what I _think_ is often not what actually _is_.

-- 
wolverian


signature.asc
Description: Digital signature


Re: (1,(2,3),4)[2]

2005-05-25 Thread wolverian
On Wed, May 25, 2005 at 01:38:27PM -0500, Rod Adams wrote:
> Or use
> 
>@a <== 1,2,3;

I would just like to say that I like this idiom immensely.

my @foo <== 1, 2, 3;

reads extremely well to me, especially since I've always disliked the
usage of '=' as an operator with side effects. (I'm strange like that.)

-- 
wolverian


signature.asc
Description: Digital signature


Re: Perl development server

2005-05-24 Thread wolverian
On Tue, May 24, 2005 at 03:44:43PM +0200, Juerd wrote:
> But I like the newly suggested "feather" better, as it can relate to
> pugs AND parrot.

Feather is best one thus far, I think. I like carrot too; it's more
playful. I equate Pugs with fun a lot.

-- 
wolverian


signature.asc
Description: Digital signature


(OT) Re: Perl development server

2005-05-24 Thread wolverian
On Tue, May 24, 2005 at 02:57:42PM +0200, Carl Mäsak wrote:
> Note how close to Finnish it is.
> 
> Portuguese: cebola
> Finnish: sipoli
> 
> Might be a coincidence, but might also be a borrowed word.

(This is extremely OT for the list.)

That's 'sipuli', actually.

I'm not sure (I'm not an etymologist), but there might be a common root
in the latin name - Allium _cepa_ Linnaeus. It seems to have had
multiple common latin names in the past, most of them based on 'cepa'.
'Cepae' is remarkably close to Finnish, although the ending is
different.

(Finnish in general has some _very_ old forms of words that have
degenerated ages ago in other languages.)

-- 
wolverian


signature.asc
Description: Digital signature


Re: Perl development server

2005-05-24 Thread wolverian
On Tue, May 24, 2005 at 12:12:57PM +0200, Juerd wrote:
> I'm currently considering 'ui', which is Dutch for 'onion'. I bet almost
> nobody here knows how to pronounce ui ;)

That reads 'user interface' to me, which I think isn't what we want.

How about 'sipuli'? That's what onion is called in Finnish. :)

Anyway, I do think the name should be English, to be as accessible as
possible. 'Feather' is nice, and reminds me of Pugs's origins. On the
other hand, maybe 'falcon' (as terribly cliched as it is) is more
accurate of Pugs nowadays.

-- 
wolverian


signature.asc
Description: Digital signature


Re: Perl development server

2005-05-23 Thread wolverian
On Mon, May 23, 2005 at 05:18:45PM +0200, Juerd wrote:
> Hi,

Hello :)

> because I see some people struggle to get things like GHC working, and
> then to get make and a compiler working, and because some people have
> limited bandwidth which makes big svn updates a less pleasant
> experience, and for other reasons, I decided to have my company,
> Convolution, sponsor a shell server.

Lots of thanks for this. A dedicated server will make my life easier, at
least.

> If you want access, please let me know. I will send you a temporary
> password by e-mail, that I expect you to change the first time you get
> the chance.

I'd like a login, username wolverian. Thanks!

> Please let me know which software you want installed. If it's in Debian
> and doesn't conflict with other software, you can have it (but no X or
> openoffice, or the like). If it's not in Debian, you'll have to compile
> it yourself.

All I need are the basics - vim, scp. I think those are installed by
default, anyway. A perl-enabled version of vim would be nice. 

-- 
wolverian


signature.asc
Description: Digital signature


Re: ^method ?

2005-05-16 Thread wolverian
On Mon, May 16, 2005 at 02:26:02PM -0400, Matt Fowles wrote:
> $.foo
> @.foo
> %.foo
> 
> and their ilk operate on the current invocant, $?SELF.  This leads
> naturally toward &.foo also refering to $?SELF.  But as we all know
> the & is optional on function calls...

I believe you are thinking in Perl 5. :) In Perl 6, &foo is a reference
to the function foo, and never a call. That makes it symmetric with the
other $.foo notations.

> Matt

-- 
wolverian


signature.asc
Description: Digital signature


Re: single element lists

2005-05-11 Thread wolverian
On Wed, May 11, 2005 at 11:45:12AM -0500, Jonathan Scott Duff wrote:
> We're discussing the proper semantics of (1)[0] on #perl6. Here's
> where we're at so far:
> 
> 1. specialise ()[] to parse as (,)[]
> 2. scalars are singleton lists, so ()[] naturally
> 3. make (1)[0] die horribly.

(1)[0] means 1[0], which is probably undefined, so it dies. That could
be detected at compile time. (my $foo = 1)[0] means $foo[0], which would
die at runtime, unless there's type inference going on. In any case, I
don't see a List in ()[] without a list-creating expression in the ().

> -Scott

-- 
wolverian


signature.asc
Description: Digital signature


Re: Code classes

2005-05-02 Thread wolverian
On Mon, May 02, 2005 at 06:22:03PM +0200, Ingo Blechschmidt wrote:
> &.foo# method of $?SELF
>  .foo# method of $?SELF
>$_.foo# method of $_

We could also define them as:

&.foo   # method on $?SELF
.foo# method on $_
$_.foo  # method on $_

The .foo syntax is very special, after all, so you can't really be
consistent with it. I prefer it be the topic, in any case.

-- 
wolverian


signature.asc
Description: Digital signature


Re: Blocks, continuations and eval()

2005-04-21 Thread wolverian
On Tue, Apr 12, 2005 at 04:17:56AM -0700, Larry Wall wrote:
> We'll make continuations available in Perl for people who ask for
> them specially, but we're not going to leave them sitting out in the
> open where some poor benighted pilgrim might trip over them unawares.

Sorry for replying so late, but I missed your reply somehow. I just want
to ask a little clarification on this; exactly what kind of hiding are
you considering for continuations? That is, do you just mean that there
will not be a 'call/cc' primitive by default in the global namespace?
I'm fine with that, as that's just one method of capturing the calling
continuation.

> Larry

-- 
wolverian


signature.asc
Description: Digital signature


Re: Context of hash slices; quotation adverbs

2005-04-19 Thread wolverian
On Mon, Apr 18, 2005 at 04:00:53PM -0700, Larry Wall wrote:
> %num_of_lines = [EMAIL PROTECTED];
> 
> : because the Perl 5 way would put a reference to @file in the hash.
> : Scalar context always makes references now, from what I understand.
> 
> Interestingly, a stored reference would track the current number of
> lines rather than taking a snapshot.  But you should definitely think
> of it as storing a reference rather than the number of lines, because
> the ref will certainly behave differently in string context.
> 
> Larry

How sane would it be to put a reference to the instance method in the
hash? I think Perl 6 doesn't actually support that directly, but one can
always do:

%num_of_lines = List::elems.assuming(@file);

I'm not sure if the currying works correctly there. How does one curry
the invocant? (I'm thinking about a situation when the method doesn't
specify the invocant explicitly in the signature, if that makes any
difference.)

I like the whole idea of bound references (to use the Pythonic term),
although Python's syntax lends itself better to such use. Sometimes I
wish we would require parentheses on every method and sub call. Then a
reference to the method/sub would be simply its name without the parens.

I hope I never have to design my own language. I would be schizophrenic
before the day ends.

-- 
wolverian


signature.asc
Description: Digital signature


Re: Blocks, continuations and eval()

2005-04-08 Thread wolverian
On Fri, Apr 08, 2005 at 12:18:45PM -0400, MrJoltCola wrote:
> I cannot say how much Perl6 will expose to the high level language.

That is what I'm wondering about. I'm sorry I was so unclear.

> Can you tell me what your idea of a "scope" is? I'm thinking a
> continuation, and if that is what you are thinking, I'm thinking the
> answer to your question is yes.

Yes. I want to know how Perl 6 exposes continuations, and how to get one
for, say, the current lexical scope, and if it has a method on it that
lets me evaluate code in that context (or some other way to do that).

> -Melvin

-- 
wolverian


signature.asc
Description: Digital signature


Re: Blocks, continuations and eval()

2005-04-08 Thread wolverian
On Fri, Apr 08, 2005 at 08:35:30AM -0700, David Storrs wrote:
> I'm unclear on what you're looking for.  Are you trying to get a way
> to do interactive coding in P6?  Or the ability to "freeze" a scope
> and execute it later?  Or something else?

Neither in itself. I'm looking for a way to refer to scopes
programmatically. I'm also asking if they are continuations, or blocks,
or coderefs, or are those all the same?

The two things you mention are effects of being able to refer to scopes
in such a fashion. I do want both, but the real question isn't if they
are possible, but about what blocks, coderefs and scopes are.

I'm sorry if I was unclear. I probably should have spent more time
writing the post. :)

> --Dks

--
wolverian


signature.asc
Description: Digital signature


Blocks, continuations and eval()

2005-04-08 Thread wolverian
Hi,

(I'm sorry if this topic has already been discussed.)

one day a friend asked if Perl 5 had a REPL facility.
(Read-Eval-Print-Loop). I told him it has perl -de0, which is different
in that it does not preserve the lexical scope across evaluated lines.
This is because eval STRING creates its own scope, in which the string
is then evaluated.

You can hack around this with a recursive eval(), which will eventually
blow the stack. I wrote a short module to do this, but never released
it. Have others done this? :)

To get to the real topic:

In Perl 6, the generic solution to fix this (if one wants to fix it)
seems, to me, to be to add a .eval method to objects that represent
scopes. I'm not sure if scopes are first class values in Perl 6. Are
they? How do you get the current scope as an object? Are scopes just
Code objects?

On #perl6, theorbtwo wasn't sure if .eval should be a method on coderefs
or blocks. Is there a difference between the two? I always hated this
about Ruby; there seems to be no practical value to the separation.

Also, are blocks/coderefs/scopes continuations? Should .eval be a method
in Continuation?

Thanks,

-- 
wolverian


signature.asc
Description: Digital signature


Re: Pugs Bug

2005-04-05 Thread wolverian
On Tue, Apr 05, 2005 at 09:21:41AM -0700, Larry Wall wrote:
> Plus you really don't want to clutter the Str type with every little
> thing you might want to do with a string.  "foo".open() will probably
> work, but only because it doesn't find a Str.open and fails over to
> MMD dispatch, which ends up finding a filehandle constructor.

"foo".open is just weird. Here I would definitely want at least a
warning, if just for my sanity.

> words(@array)

On the other hand, @array.words seems just as natural as $string.words
to me. I'm not sure how to reconcile this.

Does [EMAIL PROTECTED] DWIM, by the way? I'm not sure about the precedence.

> Maybe there's a pragma that lets you control how much coercion
> happens.

use coercion :oppressively; # They're adverbs, after all!

> Larry

--
wolverian


signature.asc
Description: Digital signature


Re: Pugs Bug

2005-04-05 Thread wolverian
(Replying to p6l instead of p6c as requested.)

On Mon, Apr 04, 2005 at 10:39:16AM -0700, Larry Wall wrote:
> (Now that builtins are just functions out in * space, we can probably
> afford to throw a few more convenience functions out there for common
> operations like word splitting and whitespace trimming.  (Specific
> proposals to p6l please.))

Shouldn't these be just methods? 

> Larry

-- 
wolverian


signature.asc
Description: Digital signature


Re: New S29 draft up

2005-04-02 Thread wolverian
On Mon, Mar 21, 2005 at 03:31:53PM +0100, Juerd wrote:
> In fact, won't things be much easier if shift and pop workend on strings
> as well as on arrays? Now that we have multis, this should be easy to
> do.
 
How about defining String is Array? I don't know if I would like that,
but it's an idea.

> Juerd

--
wolverian


signature.asc
Description: Digital signature


List constructors

2005-03-09 Thread wolverian
Hi all,

reading [AS]02 left me a bit unclear on list construction. Specifically,
as comma still seems to be the list constructor, what do these produce:

my $a   = (1, 2);   # a List object of 1, 2?
my $a   = (1);  # Int 1?
my $a   = (1,); # List of 1?
my ($a) = (1, 2);   # Int 1? Or does it need *?
my ($a,)= (1, 2);   # Same as above, I hope...
my ($a, $b) = (1);  # $a == 1, I presume

Also what do these rather esoteric cases do:

my ()   = ();
my $a   = ();
my ($a) = ();

Syntax errors in a few of those are welcome. :)

--
wolverian


signature.asc
Description: Digital signature


Re: Comma in (sub) traits?

2005-03-09 Thread wolverian
On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote:
> Here are some alternatives you don't seem to have considered:

[...]

> my Str sub greeting (Str $person) is export {
> "Hello, $person";
> }
> 
> my Str
> sub greeting (Str $person) is export {
> "Hello, $person";
> }

Do these declare the subroutine in the lexical scope only?

> And I try to believe six foolish consistencies before breakfast each day. :-)

I'm glad you do! I value consistency a lot, but I do realise one has to
choose the _right_ consistencies.

Anyway, thanks for replying. I think I can live with the issue. :) It seems to
center on the fact that Perl 6 allows you to put a lot of stuff into the
signature. This isn't helped much by any potential Haskell-style pattern
matching, at least not in a way I can see.

I still do want to match against constants in the signature, however:

sub foo ( 0 ){ ... }
sub foo ( $bar ) { ... } 

So I'm very confused about my opinion on the issue of pattern matching..

> Larry

--
wolverian


signature.asc
Description: Digital signature


Comma in (sub) traits?

2005-03-07 Thread wolverian
Hello all,

while writing some experimental code with Pugs, I realised that it is a
bit hard for me to parse the following type of declaration:

sub greeting (Str $person) returns Str is export {
"Hello, $person"
}

Specifically, the 'is export' trait is too buried. Reformatting it like
this helps:

sub greeting (Str $person)
returns Str is export {
"Hello, $person"
}

But I really do not like the vertical alignment of the traits and the
body of the sub. So we're back to the first situation. We could also put
the 'returns' on the first line, after the signature (and strictly
speaking it at least can be a part of the signature), and the traits on
successive lines after that, but the alignment problems kicks in again.

There are other ways to format the declaration, like indenting the
traits line:

sub greeting (Str $person) returns Str
is export {
"Hello, $person"
}

This looks distinctly odd to me, although I think it works better than
the aligned version. Moving the traits line to column 0 is even weirder.

I think it is clear that I do not want to put the { on its own line. :)

The problem can be alleviated a bit by giving each trait a more
separable visual identity:

sub greeting (Str $person) returns Str, is export {
"Hello, $person"
}

The above works better for me than either of the previous examples. So
my question is: can this be legal Perl 6 code (and will it DWIM)? There
are ways to format this I didn't think of, I'm sure, so I'd like to know
too what the recommended style is. (perl6doc perlstyle...)

This same problem (well, it is a problem to me) applies to other places
where traits are used as well, but I'm specifically asking in the
context of named subroutine declarations, since parsing the comma seems
at least possible there. The visual distinction in a regular 'my'
declaration brought by the comma might also look too much like a list.
(It probably is a list.)

Sorry if this has been discussed before, or even in the design
documents. I'm also sorry if this is too rambling for the list. It's not
that important, just a thought.

Cheers,
wolverian


signature.asc
Description: Digital signature