Damian Conway [EMAIL PROTECTED] writes:
Piers Cawley wrote:
Cis is compile-time.
So, how would one create a class which inherits from some other
class
when you don't know what said other class is until runtime?
Use Perl5-ish classes, or an Ceval.
Perl5-ish classes? You mean 'bless {},
Damian Conway [EMAIL PROTECTED] writes:
Piers Cawley wrote:
[Speculations elided]
Which is somewhat dependent on being able to do Cclass is $class.
Which you can't do, since Cis is compile-time.
So, how would one create a class which inherits from some other class
when you don't know what
Piers Cawley wrote:
Cis is compile-time.
So, how would one create a class which inherits from some other class
when you don't know what said other class is until runtime?
Use Perl5-ish classes, or an Ceval.
Does this work:
class {
push @ISA, $class;
...
}
I
Piers Cawley:
# So, how would one create a class which inherits from some
# other class when you don't know what said other class is
# until runtime?
AUTOLOAD! *ducks*
--Brent Dax [EMAIL PROTECTED]
@roles=map {Parrot $_} qw(embedding regexen Configure)
If you want to propagate an
Piers Cawley wrote:
[Speculations elided]
Which is somewhat dependent on being able to do Cclass is $class.
Which you can't do, since Cis is compile-time.
Damian
On Tue, 12 Nov 2002 21:11:36 +, Piers Cawley wrote:
Michael Lazzaro [EMAIL PROTECTED] writes:
On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote:
I still prefer cached, which sounds less lingo-ish than memoized
but reads better than same (Same as what?).
Insert
On Fri, Nov 08, 2002 at 08:35:00PM +1100, Damian Conway wrote:
: What you want are conversion-to-(num|str|bool) methods:
:
: sub a_pure_func(Num $n) returns Num {
: class is Num {
: has Num $cache;
: sub value { $n * $n }
: method
On Tue, Nov 12, 2002 at 09:03:22PM +, Piers Cawley wrote:
: Hang on, couldn't you rewrite things to not use the cache?
:
: class is $class {
: sub value { func(*args) }
: method operator:+ ($self is rw:) { +($self = value) }
: method operator:~ ($self is rw:) { ~($self =
Damian Conway [EMAIL PROTECTED] writes:
Luke Palmer wrote:
sub a_pure_func(Num $n) returns Num {
class is Num {
method FETCH { $n * $n } }.new }
Yes? No?
Not quite.
sub a_pure_func(Num $n) returns Num {
class is Num {
has
Michael Lazzaro [EMAIL PROTECTED] writes:
On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote:
I still prefer cached, which sounds less lingo-ish than memoized
but reads
better than same (Same as what?).
Insert obligatory reference to Eiffel here, which IIR uses the word
[ I've added some of Damian's text back into Michael's message to save
replying to two separate messages. ]
On Mon, Nov 11, 2002 at 09:44:37AM -0800, Michael Lazzaro wrote:
On Monday, November 11, 2002, at 02:19 AM, Damian Conway wrote:
I can certainly see your point, but to me this is
Paul Johnson [EMAIL PROTECTED] writes:
[ I notice that Piers has just said about the same as me in one
sentence. ]
Ah, but I get lots of practice boiling stuff down when I'm writing the
summaries. Though the current one is still giving me headaches -- I'm
about halfway through perl6-language
Nicholas Clark wrote:
We're looking for a word that tersely expresses
has_no_side_effects_and_can_safely_have_its_results_cached_based_on_parameter_types_
and_values_and_calling_context ?
And to people in the perl5 know, Memoize is the module that implements this,
hence why people who know
Paul Johnson wrote:
Part of the reason I would prefer something like pure over something
like cached is because it describes the function rather than telling
the compiler how to deal with it. That feels better to me. It's
working at a higher level. Maybe the end result is the same, or maybe
On Monday, November 11, 2002, at 02:19 AM, Damian Conway wrote:
One of the reasons I like Ccached is because it does specify
exactly the way the subroutine is to behave (i.e. be called the first
time,
and not called every subsequent time the same arguments are supplied).
So
I can do
Damian Conway wrote:
we could make it lazy thus:
sub a_pure_func(Num $n) is lazy returns Num {
return $n ** $n
}
which would cause any invocation of Ca_pure_func to cache
its arguments (probably in a closure) and return a proxy
Num that carries out the computation
Billy Naylor asked:
Would it be useful to apply memoization in a similar fashion...
sub square ( Num $n ) is memo {
return $n ** $n;
}
Yes. Larry indicated this in A2
(see http://search.cpan.org/perl6/apo/A02.pod#Properties).
The name of the property is still under debate. Larry
Luke Palmer wrote:
sub a_pure_func(Num $n) returns Num {
class is Num {
method FETCH { $n * $n } }.new
}
Yes? No?
Not quite.
sub a_pure_func(Num $n) returns Num {
class is Num {
has Num $cache;
method FETCH { $cache //=
On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote:
Billy Naylor asked:
Would it be useful to apply memoization in a similar fashion...
sub square ( Num $n ) is memo {
return $n ** $n;
}
Yes. Larry indicated this in A2
(see
On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote:
On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote:
The name of the property is still under debate. Larry favours:
sub square ( Num $n ) is same {...}
whereas others feel that:
sub square ( Num $n
Date: Fri, 8 Nov 2002 15:04:16 +
From: Nicholas Clark [EMAIL PROTECTED]
And to people in the perl5 know, Memoize is the module that implements this,
hence why people who know of how and what Memoize can do favour that name.
Except that it's not necessarily obvious to everyone else?
Luke Palmer:
# What's wrong with Ccached?
#
# Cpure ain't bad either, but it won't appeal to
# non-mathematicians---even certain kinds of mathematicians.
# Mathematica thinks a pure function is what we think of as
# an anonymous sub. So I like Ccached.
How about Csteady, in an analogy to
On Fri, Nov 08, 2002 at 12:12:53PM -0700, Luke Palmer wrote:
What's wrong with Ccached?
Cpure ain't bad either, but it won't appeal to
non-mathematicians---even certain kinds of mathematicians.
Mathematica thinks a pure function is what we think of as an
anonymous sub. So I like Ccached.
On Fri, Nov 08, 2002 at 05:30:00PM +0100, Paul Johnson wrote:
On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote:
On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote:
The name of the property is still under debate. Larry favours:
sub square ( Num $n ) is same
Jonathan Scott Duff wrote:
On Fri, Nov 08, 2002 at 05:30:00PM +0100, Paul Johnson wrote:
On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote:
On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote:
The name of the property is still under debate. Larry favours:
sub square
On Fri, Nov 08, 2002 at 11:41:38AM -0800, Brent Dax wrote:
Luke Palmer:
# What's wrong with Ccached?
#
# Cpure ain't bad either, but it won't appeal to
# non-mathematicians---even certain kinds of mathematicians.
# Mathematica thinks a pure function is what we think of as
# an anonymous
I still prefer cached, which sounds less lingo-ish than memoized but reads
better than same (Same as what?).
Billy Naylor asked:
Would it be useful to apply memoization in a similar fashion...
sub square ( Num $n ) is memo {
return $n ** $n;
}
Yes. Larry indicated this in
Paul Johnson [EMAIL PROTECTED] writes:
On Fri, Nov 08, 2002 at 12:12:53PM -0700, Luke Palmer wrote:
What's wrong with Ccached?
Cpure ain't bad either, but it won't appeal to
non-mathematicians---even certain kinds of mathematicians.
Mathematica thinks a pure function is what we think of
On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote:
I still prefer cached, which sounds less lingo-ish than memoized
but reads
better than same (Same as what?).
Insert obligatory reference to Eiffel here, which IIR uses the word
once:
sub square ( Num $n ) is same { ... }
Piers Cawley mused:
The idea being that, when you do
a_pure_func($val1|$val2|$val3)
instead of Perl going away and doing the calculation right away, you
get back a 'special' superposition
Remember to s/superposition/junction/g. For this week, at least ;-)
which stores an 'invocation
Date: Thu, 07 Nov 2002 20:48:50 +1100
From: Damian Conway [EMAIL PROTECTED]
we could make it lazy thus:
sub a_pure_func(Num $n) is lazy returns Num {
return $n ** $n
}
which would cause any invocation of Ca_pure_func to cache
its arguments (probably in a closure)
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
From: Luke Palmer [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Thu, 7 Nov 2002 13:49:14 -0700 (MST)
X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
Date: Thu, 07 Nov 2002 20:48:50 +1100
From: Damian Conway [EMAIL
Luke Palmer wrote:
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
From: Luke Palmer [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Thu, 7 Nov 2002 13:49:14 -0700 (MST)
X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
Date: Thu, 07 Nov 2002 20:48:50 +1100
From: Damian Conway
It occurred to me that being able to set up 'pure' functions in such a
way that they are lazily evaluated when passed a superposition might
be a win.
And then I got to thinking about what would be required from the
language to allow me to implement this functionality in a module. I am
assuming
34 matches
Mail list logo