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

2005-07-14 Thread Nathan Gray
On Thu, Jul 14, 2005 at 05:37:38PM +0200, Carl Mäsak wrote:
> On 7/14/05, Juerd <[EMAIL PROTECTED]> wrote:
> > It's just a Solomon judgement situation. That can work out well, but I
> > really hate when it's forced and used to test patience.
> 
> If Juerd is right about this being a solomonian situation, let me just
> give up my baby to the other woman by saying:
> 
> * "It's hers." It's not important what syntax you give it. `./` is ok,
> but I trust @larry to make the right choice there.
> 
> * "Please don't hurt my baby." Let `.foo` still mean `$_.foo`,
> unconditionally. That's all that really matters.

Yes, let .foo still mean $_.foo, unconditionally, please.

The `./` is nice, but I'm willing to give up the syntax in favor of
letting .foo always mean $_.foo.

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 decent choice that will
serve the community well.

So long as .foo (pretty please) means $_.foo all the time (with sugar on
top?).

-kolibrie


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

2005-07-14 Thread Nathan Gray
On Fri, Jul 15, 2005 at 01:09:57AM +0300, Yuval Kogman wrote:
> On Thu, Jul 14, 2005 at 13:39:44 -0700, Larry Wall wrote:
> > On Thu, Jul 14, 2005 at 12:55:26PM -0400, Nathan Gray wrote:
> > : So long as .foo (pretty please) means $_.foo all the time (with sugar on
> > : top?).
> > 
> > It means that all the time, but only when unambiguous.  If you say
> > 
> > use dot;
> 
> I'd rather have '.foo' not work on $?SELF at all than have that.

Um, that's what I was hoping for too.  Let .foo mean $_.foo, and never
$?SELF.foo, unless of course $_ happens to contain $?SELF at that
moment.

(sugar, anyone?)

-kolibrie


Re: Object Model Pictures

2005-09-12 Thread Nathan Gray
On Mon, Sep 12, 2005 at 03:10:55PM -0400, Stevan Little wrote:
> In my never ending quest to implement the Perl 6 object model, I have  
> started drawing pictures. Here is the latest version:
> 
> http://svn.openfoundry.org/pugs/perl5/Perl6-MetaModel2.0/docs/ 
> p6_object_model.jpg

Awesome diagram.

> I would appreciate any comments/questions/suggestions anyone has to  
> offer.

In my never ending quest to understand the Perl 6 object model, I think
it has become clearer each time I've discovered another document or
picture.

Thank you Stevan!

> A few things to note:
> 
> - Roles are not yet included in this, I am of the opinion that the  
> core MetaModel should be role-less, and roles will be laid on top of  
> the core metamodel post-bootstrapping. This makes the most sense  
> currently, however, this may change down the road, either way I think  
> it is an implementation detail as long as it "looks" the same when  
> everything is loaded.

Yep, someone needs to make a diagram about Roles, too.

-kolibrie


Re: Object Model Pictures

2005-09-21 Thread Nathan Gray
On Tue, Sep 20, 2005 at 08:16:23PM -0400, Stevan Little wrote:
> http://svn.openfoundry.org/pugs/perl5/Perl6-MetaModel2.0/docs/ 
> p6_role_model.jpg
> 
> I am planning on making Roles self-bootstrapping, so the class(Role)  
> will actually be the first Role in the system. From there, Class will  
> do Role, and Role will do Role. This also means that all the  
> instances of Class will also do Role, which means that classes  
> automatically can also be used as Roles.

Thanks for the pictures, Stevan.

So every time a class does a new role, a new instance of the class is
created as the role.

If a class does three roles, there will be three role instances of
the class, as well as the class' own instance of itself, and a user
instance.

When a method is called on the user instance, it asks the class instance
if it can do the method, and the class instance looks at the methods in
the class, and then at the methods in each role, and dispatches to the
appropriate method definition.

A role can be "done" by several classes at once, because a new instance
is created for each class, specific to the class.

Methods defined in a class are not clobbered by methods defined in a
role.  Rather, methods in a role are only catalogued by the class
instance if it does not already have a method definition for that name.
The order that a class does roles is significant, because if two roles
define the same method, only the first one is catalogued by the class
instance.

-kolibrie


Re: Stringification, numification, and booleanification of pairs

2005-09-23 Thread Nathan Gray
On Thu, Sep 22, 2005 at 11:59:32AM -0400, Matt Fowles wrote:
> Well said!  I completely agree that string interpolation should be
> handled exactly the same as stringification.  I would like C< ("foo is
> $foo of course") eq ("foo is " ~ $foo ~ " of course") > at all times.

Yes.

S03 states:

  Unary ~ now imposes a string context on its argument, and + imposes a
  numeric context (as opposed to being a no-op in Perl 5). Along the
  same lines, ? imposes a boolean context, and * imposes a list context.

That seems to indicate that ~$foo eq "$foo".

If however, you want $foo to interpolate to something else, you can do
that in several ways:

  "hello { +$foo }"
  "hello { $foo.as(...) }"

Or when concatenating:

  "" ~ +$foo ~ ""
  "" ~ $foo.as(...) ~ ""

-kolibrie


Re: Standard library for perl6? (graphical primitives)

2005-10-18 Thread Nathan Gray
On Sat, Oct 15, 2005 at 08:33:26AM +0300, Markus Laire wrote:
> Could it be possible to create a "Standard library" for perl6, which 
> would also include graphical primitives (putpixel, getpixel, 
> getcolordepth, putimage, getimage, copyrectangle)?

I'm interested in creating a perl6 binding to cairo
(http://cairographics.org), but haven't gotten anywhere close to
starting that project.

-kolibrie


Re: Flunking tests and failing code

2005-12-05 Thread Nathan Gray
On Mon, Dec 05, 2005 at 07:54:25AM +, Luke Palmer wrote:
> I wonder if there is a macroey thing that we can do here.  That is,
> could we make:
> 
> ok(1);
> is(1, 1);
> like("foo", /foo/);
> 
> Into:
> 
> ok(1);
> ok(1 == 1);
> ok("foo" ~~ /foo/);
> 
> And lexically analyze the argument to ok() to find out how to report
> the error?  Something in the style of Smart::Comments which looks at
> subexpressions and tells you about them automatically.

I like that a lot.

-kolibrie




Re: Heredoc issue in pugs.

2006-08-22 Thread Nathan Gray
On Wed, Aug 23, 2006 at 02:16:11AM +0800, Yiyi Hu wrote:
> #!/usr/bin/env pugs
> 
> my $a = q:t /END/
> test
> END;
> 
> $a.perl.say;
> 
> Above example works ok in pugs, But the problem is.
> From S02
> 
> Heredocs are no longer written with <<, but with an adverb on any
> other quote construct:
> 
>print qq:to/END/;
>Give $amount to the man behind curtain number $curtain.
>END
> 
> Which is correct?

If I remember correctly, Larry and Audrey discussed this at the
Chicago hackathon and updated the Synopsis at that time.

So my guess is that the Synopsis is correct.

-kolibrie



Re: Capture sigil

2006-09-20 Thread Nathan Gray
On Wed, Sep 20, 2006 at 12:28:10PM -0700, Larry Wall wrote:
> Bikeshed: What should that sigil be?  And if it's in Latin-1, what's the
> ASCII workaround?

The one that springs out to me is: 

> ¤   00A4CURRENCY SIGN

Probably because it looks like a container with something captured
inside it, or trying to break out, and because we use currency to 
pass value(s) between individuals.

I don't have an ASCII suggestion.

-kolibrie



Re: Perl 6 Microgrants. Now accepting proposals.

2007-03-22 Thread Nathan Gray
On Thu, Mar 22, 2007 at 01:24:58PM +, Tim Bunce wrote:
> Here's a related idea: write a tool that reads BNF grammar, such as
> http://java.sun.com/docs/books/jls/third_edition/html/syntax.html
> http://java.sun.com/docs/books/jls/third_edition/html/grammars.html
> and writes a parser in Perl 6 for that grammar.

Writing a Perl 6 grammar to parse BNF should not be too hard.  Writing
an emitter to translate that into a Perl 6 grammar should also not be
very hard, though I find emitters harder to write.

I'm thinking of an architecture similar to Flavio Glock's MiniPerl6.

  http://svn.pugscode.org/pugs/v6/v6-MiniPerl6/lib/MiniPerl6/

> Anyone interested in those ideas?

Quite interested, though lacking tuits at the moment.

-kolibrie



signature.asc
Description: Digital signature


Re: Looking for help updating Perl 6 and Parrot part of Perl Myths talk

2009-09-16 Thread Nathan Gray
On Mon, Sep 14, 2009 at 12:15:05PM +0100, Tim Bunce wrote:
> You can find my current draft at http://files.me.com/tim.bunce/65oikg (2.3MB 
> PDF)

page 73 - Haskell should be spelled with two Ls

-kolibrie



Re: [pugs]weird thing with say ++$

2005-04-21 Thread Nathan Gray
On Thu, Apr 21, 2005 at 11:45:27AM +0200, Paul Johnson wrote:
> On Thu, Apr 21, 2005 at 04:32:41PM +0800, fayland wrote:
> 
> > It has been published at perl6.language, but have no reply.
> > 
> > In perl v5.8.6 built for MSWin32-x86-multi-thread:
> > 
> > my $i = 1;
> > print $i++, ++$i; # 1 3
> > my $i = 1;
> > print ++$i, $i++; # 3 2
> > 
> > in pugs:
> > 
> > my $i = 1;
> > say $i++, ++$i; # 1 3
> > 
> > my $i = 1;
> > say ++$i, $i++; # 2 2
> > 
> > which is right?(I think perl5 is) or it's different between Perl5 and Perl6?
> 
> I think I understand the implementation details leading to each
> behaviour, but rather than saying which was "right", I think I'd be
> quite happy to see Perl6 copy (the ideas behind) C's rules regarding
> sequence points and undefined behaviour.  I'm not so sure about
> implementation defined and unspecified behaviour.

It certainly makes more sense to me that the answer would be 2 2.  But
however it ends up, so long as we know what the answer will be, we can
utilize it effectively in our programs.

-kolibrie


Re: Perl development server

2005-05-23 Thread Nathan Gray
On Mon, May 23, 2005 at 12:00:14PM -0400, Stevan Little wrote:
> On May 23, 2005, at 11:25 AM, 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.

Juerd, why am I getting everyone's responses, but not your original
messages?

> lambdacamels.perl6.nl?

That's catchy, and we could all remember it.  Or in keeping with the
Tolkien theme, there's always:

  silmaril.perl6.nl
  valinor.perl6.nl

or some such.

-kolibrie


Re: Perl development server

2005-05-23 Thread Nathan Gray
On Mon, May 23, 2005 at 06:51:31PM +0200, Juerd wrote:
> Nathan Gray skribis 2005-05-23 12:50 (-0400):
> > > >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.
> > Juerd, why am I getting everyone's responses, but not your original
> > messages?
> 
> I have no idea. I'm sending these messages to the two mailing lists, and
> from there on, I can't track where they're going (or not)

Got this one.  Weird.

-kolibrie



Re: Perl development server

2005-05-24 Thread Nathan Gray
On Mon, May 23, 2005 at 05:18:45PM +0200, Juerd wrote:
> Everyone who wants, can get a login. Access is provided via SSH version
> 2 only (Windows users can use PuTTY and WinSCP), and the box may be used
> for everything that improves Perl 6 development. Users are encouraged to
> keep files world readable for transparency.
> 
> 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.

May I have an account name 'kolibrie'?

> 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.

I tend to like to have a copy of 'darcs' on-hand, and I really like
'screen'.

Thanks for this great service to the Perl6 community!

-kolibrie


pgpnoqL2uGdL0.pgp
Description: PGP signature


Re: Perl development server

2005-05-24 Thread Nathan Gray
On Mon, May 23, 2005 at 06:51:31PM +0200, Juerd wrote:
> Nathan Gray skribis 2005-05-23 12:50 (-0400):
> > > >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.
> > Juerd, why am I getting everyone's responses, but not your original
> > messages?
> 
> I have no idea. I'm sending these messages to the two mailing lists, and
> from there on, I can't track where they're going (or not)

Ah, here they all come.  p6c must have taken longer than p6l.

-kolibrie


date and time formatting

2005-05-31 Thread Nathan Gray
As I am interested in human-readable dates and times, and having found
no conclusive discussion on time formatting, I make my recommendation
for a syntax (to start discussion, and allow for date formatting to be
implemented in pugs):

I would like for time() to return an object, which in numeric context is
the number of seconds from the epoch (the new epoch, of course), and
which in string context is a human-readable string.  We could also use
localtime(), and leave time() alone.

Possible syntax could be:

  $time_object = time();
  $epoch_seconds = +$time_object;
  $human_readable = ~$time_object;
  $human_readable = $time_object.format; # default format
  $human_readable = $time_object.format($pattern);
  $human_readable = $time_object.format($pattern, offset => 'local');

The default offset would probably be 'local', and would account for
daylight saving time.  The offset could be changed to a 
floating-point value indicating hours offset from UTC.  A timezone
module could perhaps allow for timezone names, which would allow for
daylight saving time computation for non-local times.  The default
offset would probably be stored in a global variable.

The default format would probably be an ISO 8601 format, like:

  1994-11-05T08:15:30-05:00

and the default format pattern would probably be stored in a global
variable, possibly as an strftime() pattern.

-kolibrie


Re: date and time formatting

2005-06-01 Thread Nathan Gray
On Wed, Jun 01, 2005 at 03:42:57PM +1200, Sam Vilain wrote:
> I've made a start on this.  See ext/Date in pugs.  I don't think that
> your views are necessarily contrary.

That's what I'm looking for.  Thank you!

> The biggest reason I didn't use DateTime was that I found it awkward
> for the common case; most of the time I just want to stuff in an
> ISO8601 date.  I also don't like implicit normalisation to seconds
> underneath the hood when I'm doing basic date calculations, and
> the way that the "DateTime" base class is inherantly based on the
> Gregorian calendar.
> 
> The "Date" and "Duration" roles are extremely minimal; see
> 
>http://svn.openfoundry.org/pugs/ext/Date/lib/Date.pm
>http://svn.openfoundry.org/pugs/ext/Date/lib/Duration.pm
> 
> The major API is described at:
> 
>http://svn.openfoundry.org/pugs/ext/Date/lib/Date/Gregorian.pod
> 
> This module is supposed to be somewhere between DateTime and
> Class::Date, with built-in ISO-8601 support (as it's the standard ;)).

So, if we continue following this API, Perl6 core will contain time(),
but no localtime() nor gmtime().  The Date module will provide human
readable date and time strings, and basic date math.

> With a bit of luck, all Date implementation can share this `Date'
> Role, and Gregorian calendar modules share the `Date::Gregorian' Role,
> so that the multitude of implementations that crop up will be mutually
> exchangable, and the simple case fast, efficient and useful.

So further date manipulation could be provided by other date modules,
hopefully within the same framework.

Sounds good to me.

-kolibrie