Re: worth adding collections to the core language?

2002-10-31 Thread Larry Wall
On Thu, 31 Oct 2002, Austin Hastings wrote:
: Damian Conway admits: "Everything in Perl6 is 'Junk'"
: 
: Who can't see *this* coming on slashdot? :-)

Cool.  Perl 6 "junk" gives new meaning to "Pathologically Eclectic Rubbish".

Larry




Re: worth adding collections to the core language?

2002-10-31 Thread Austin Hastings

--- Damian Conway <[EMAIL PROTECTED]> wrote:
> Larry wrote:
> > Possibly we might even extend the notion of hash to any "junk".
> > 
> > %hash = 1 | 2 | 3;
> 
> So you're suggestion that a "normal" hash is a junction of pairs???


Damian Conway admits: "Everything in Perl6 is 'Junk'"

Who can't see *this* coming on slashdot? :-)

=Austin

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/



Re: worth adding collections to the core language?

2002-10-30 Thread Damian Conway
Larry wrote:


The set features are a side effect of junctions, just as they're a side
effect of hashes.  An "any" junction might well be implemented underneath
as a hash without values.


Yep.



Possibly we might even extend the notion of hash to any "junk".

%hash = 1 | 2 | 3;


So you're suggestion that a "normal" hash is a junction of pairs???

Or that assigning a junction to a hash takes every state of the junction
and creates an entry for it whose value is true???

Either way I worry about this notion, because of the subtle
differences between:

	%hash = map {$^x=>1} (1,2,3);
	%hash = any(1,2,3);
	%hash = all(1,2,3);
	%hash = one(1,2,3);
	%hash = none(1,2,3)

I'd really rather not see junctions being the only scalar type that can be
marked with C<%>.

Unless, of course, we're deliberately *trying* to install nasty
inconsistencies for Simon to discover! ;-)



Then it's clearer that something junctional is going on when you say:

if $val ~~ %hash

I could see % becoming the sigil of choice for junks just for the
documentational value.


Curiously, the reduction of the documentational value of C<%> always
meaning "hash" is exactly why I *wouldn't* like to see it!

Damian




Re: worth adding collections to the core language?

2002-10-30 Thread Larry Wall
On Thu, 31 Oct 2002, Markus Laire wrote:
: And you could always have something else as a backup for those 
: unfortunates who can't use «+» - like ^[+] 
: 
: What are the good reasons not to use «» ?

It would force everyone to get their act together with respect to Unicode.
Oh, wait, that's a feature...

Larry




Re: worth adding collections to the core language?

2002-10-30 Thread Markus Laire
On 30 Oct 2002 at 11:09, Larry Wall wrote:

> On Wed, 30 Oct 2002, Piers Cawley wrote:
> :"It is a truth universally acknowledged that a language in
> : possession of a rich syntax must be in need of a rewrite."
> :  -- Jane Austen?
>
> It is a truth universally acknowledged that a language in possession
> of a rich syntax must be in need of a larger character set.
>
> I can almost taste it: French quotes for hyperoperators...
>
> @a «+» @b
> @a«++»
> @a«.anymethod(args)»

And you could always have something else as a backup for those
unfortunates who can't use «+» - like ^[+]

What are the good reasons not to use «» ?

--
Markus Laire 'malaire' <[EMAIL PROTECTED]>





Re: worth adding collections to the core language?

2002-10-30 Thread Larry Wall
On Wed, 30 Oct 2002, Piers Cawley wrote:
:"It is a truth universally acknowledged that a language in
: possession of a rich syntax must be in need of a rewrite."
:  -- Jane Austen?

It is a truth universally acknowledged that a language in possession
of a rich syntax must be in need of a larger character set.

I can almost taste it: French quotes for hyperoperators...

@a «+» @b
@a«++»
@a«.anymethod(args)»

Larry




Re: worth adding collections to the core language?

2002-10-30 Thread Piers Cawley
Piers Cawley <[EMAIL PROTECTED]> writes:
> Personally, I'd love to see something like the whole Smalltalk
> Collection hierarchy available complete with Bags, Sets,
> Dictionaries, OrderedCollections and the whole deal. I note, for
> instance that Christian Lemburg has implemented Set::Object, and
^
That's Jean-Louis Leroy, obviously. Brainfade.

-- 
Piers

   "It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
 -- Jane Austen?



Re: worth adding collections to the core language?

2002-10-30 Thread Piers Cawley
Dave Storrs <[EMAIL PROTECTED]> writes:

> In the "Re: Wh<[ie]>ther Infix Superposition ops" thread
>
> On Wed, 30 Oct 2002, Piers Cawley wrote:
>
>> But given a decent Collection hierarchy:
>>
>> my $seen = Set.new($start,$finish);
>>
>> for <> -> $next {
>> print $next unless $next =~ $seen;
>> $seen.insert($next);
>> }
>
> Just a thought...are sets (or other Collection types) something that we
> use often enough that they would deserve to be in the core language?  I
> know I've used hashes as no-repeats-allowed sets many times, so clearly
> they are commonly useful.  On the other hand, since this can be done,
> maybe there is no need to implement a new core feature for them.
>
> I suspect the answer is "no, we don't need them" but I just thought I'd
> ask; I'm curious about the design reasons either way.

Personally, I'd love to see something like the whole Smalltalk
Collection hierarchy available complete with Bags, Sets, Dictionaries,
OrderedCollections and the whole deal. I note, for instance that
Christian Lemburg has implemented Set::Object, and it's substantially
faster than a hash based implementation for insertion, and marginally
faster for lookup. See
http://search.cpan.org/author/JLLEROY/Set-Object-1.02/Object.pm#PERFORMANCE
for Christian's numbers. I would hope that we could see other
performance gains for other Collection classes. 

Taking a quick glance at a handy Smalltalk image, it seems that,
ideally one would want to have Collections in the core so that Hash
could inherit from Collection via Set. But then, anything's possible
at compile time, so one could probably set something appropriate up by
doing 'use Collections'.

-- 
Piers

   "It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
 -- Jane Austen?



Re: worth adding collections to the core language?

2002-10-30 Thread Larry Wall
On Wed, 30 Oct 2002, Dave Storrs wrote:
: In the "Re: Wh<[ie]>ther Infix Superposition ops" thread
: 
: On Wed, 30 Oct 2002, Piers Cawley wrote:
: 
: > But given a decent Collection hierarchy:
: >
: > my $seen = Set.new($start,$finish);
: >
: > for <> -> $next {
: > print $next unless $next =~ $seen;
: > $seen.insert($next);
: > }
: 
: Just a thought...are sets (or other Collection types) something that we
: use often enough that they would deserve to be in the core language?  I
: know I've used hashes as no-repeats-allowed sets many times, so clearly
: they are commonly useful.  On the other hand, since this can be done,
: maybe there is no need to implement a new core feature for them.
: 
: I suspect the answer is "no, we don't need them" but I just thought I'd
: ask; I'm curious about the design reasons either way.

The set features are a side effect of junctions, just as they're a side
effect of hashes.  An "any" junction might well be implemented underneath
as a hash without values.

Possibly we might even extend the notion of hash to any "junk".

%hash = 1 | 2 | 3;

Then it's clearer that something junctional is going on when you say:

if $val ~~ %hash

I could see % becoming the sigil of choice for junks just for the
documentational value.

Larry