Re: clarifying the spec for 'ref'

2006-09-04 Thread TSa
HaloO, Luke Palmer wrote: Removing abilities, counterintuitive though it may seem on the surface, makes the type *larger*. It is not adding constraints, it is removing them (you might not be able to call set($x) on this object anymore). Welcome to the co- and contra-variance problem again. We

Re: clarifying the spec for 'ref'

2006-08-28 Thread Juerd
Richard Hainsworth skribis 2006-08-28 10:33 (+0400): > --- > | Class > A| > | > --

Re: clarifying the spec for 'ref'

2006-08-27 Thread Richard Hainsworth
With regard to the 'square' 'isa' 'rectangle' or vice versa question, surely it is for the programmer to decide depending on the situation. Though the problem is how to define criteria for trapping problems at compile time. Regarding classes and roles, and in fact multiple inheritance in gene

Re: clarifying the spec for 'ref'

2006-08-25 Thread Luke Palmer
On 8/25/06, Daniel Hulme <[EMAIL PROTECTED]> wrote: That's because you're used to one way of thinking about class inheritance: that the subclass can do everything that the superclass can do, and more. In this scheme, you might have a Square class, with a field representing its corner and another

Re: clarifying the spec for 'ref'

2006-08-25 Thread Luke Palmer
On 8/25/06, Mark J. Reed <[EMAIL PROTECTED]> wrote: Why not? Is it any weirder than simply changing that functionality beyond recognition? You can always fake removing functionality even if the language doesn't actually support it. Yes, yes, of course. That is not the issue. We are trying t

Re: clarifying the spec for 'ref'

2006-08-25 Thread Larry Wall
On Fri, Aug 25, 2006 at 01:25:23PM -0700, Trey Harris wrote: : I think Larry nailed it with his observation about the difference between : class and role and trait. 'Constant' is a trait of another type, not a : type into itself. Hmm, well, there are several hands to be waved here. First, ther

Re: clarifying the spec for 'ref'

2006-08-25 Thread Larry Wall
On Fri, Aug 25, 2006 at 02:04:01PM -0700, Trey Harris wrote: : In any case, Larry's settled this issue. Nah, I just handwaved it harder. :) Larry

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Juerd writes: Trey Harris skribis 2006-08-25 13:26 (-0700): Explain to me how "nontraditional" DBC might work in an internally consistent way. Otherwise, this is hand-waving. :-) Perl *is* hand-waving. Yeah, but hand-waving on how it manages the behavio

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Daniel Hulme writes: If "changing that functionality beyond recognition" means changing its external behavior (as opposed to its internal behavior) so that it acts differently from what the superclass had promised to do, then no, it's not any weirder--but I

Re: clarifying the spec for 'ref'

2006-08-25 Thread Juerd
Trey Harris skribis 2006-08-25 13:26 (-0700): > Explain to me how "nontraditional" DBC might work in an internally > consistent way. Otherwise, this is hand-waving. :-) Perl *is* hand-waving.

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Juerd writes: Trey Harris skribis 2006-08-25 11:33 (-0700): Ok... same thing from a DBC perspective. Subclasses can add functionality (by AND'ing postconditions), or remove constraints (by OR'ing preconditions), but they can't traditionally remove functiona

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Mark J. Reed writes: OK, I admit I wasn't thinking about things from a DBC perspective, and misunderstood "DBC" to be a reference to some database module. I here am new and I didn't have context. My bad. But if we're talking design-by-contract, I don't see

Re: clarifying the spec for 'ref'

2006-08-25 Thread Juerd
Trey Harris skribis 2006-08-25 11:33 (-0700): > Ok... same thing from a DBC perspective. Subclasses can add functionality > (by AND'ing postconditions), or remove constraints (by OR'ing > preconditions), but they can't traditionally remove functionality or add > constraints. I just want to rea

Re: clarifying the spec for 'ref'

2006-08-25 Thread Daniel Hulme
> If "changing that functionality beyond recognition" means changing its > external behavior (as opposed to its internal behavior) so that it > acts differently from what the superclass had promised to do, then > no, it's not any weirder--but I can't figure out how the contract > would work, eith

Re: clarifying the spec for 'ref'

2006-08-25 Thread Mark J. Reed
On 8/25/06, Mark J. Reed <[EMAIL PROTECTED]> wrote: I here am new and I didn't have context. Well, technically, I here am not new; I've been here since before Apoc 1. But I hadn't been paying close attention for a while until recently. :) Either way, I didn't get the ref. -- Mark J. Reed <[

Re: clarifying the spec for 'ref'

2006-08-25 Thread Mark J. Reed
OK, I admit I wasn't thinking about things from a DBC perspective, and misunderstood "DBC" to be a reference to some database module. I here am new and I didn't have context. My bad. But if we're talking design-by-contract, I don't see how "Array is Array::Const" can work, either, since I consi

Re: clarifying the spec for 'ref'

2006-08-25 Thread Larry Wall
On Fri, Aug 25, 2006 at 12:38:33PM -0700, Trey Harris wrote: : But in order to allow that choice, the language has to impose some : groundrules for everyone. strict couldn't exist in Perl 5 if lexicals : could autovivify. And--*by my understanding of DBC*--subclasses can't : remove promised fu

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Mark J. Reed writes: On 8/25/06, Trey Harris <[EMAIL PROTECTED]> wrote: > subclasses can remove functionality as well as adding it Can someone suggest some reading I can do to understand how that works? I can't wrap my head around the idea of subclasses r

Re: clarifying the spec for 'ref'

2006-08-25 Thread Paul Seamons
> Does this mean you can't write > >class Super { method something { ... } } > >sub foo (Super $bar) { $bar.something() } > > and expect foo($obj) to work, because $obj might be: > >class Sub is Super { # remove .something--how does that happen? } > >foo($obj); # Boom!? > > So what

Re: clarifying the spec for 'ref'

2006-08-25 Thread Mark J. Reed
On 8/25/06, Trey Harris <[EMAIL PROTECTED]> wrote: > subclasses can remove functionality as well as adding it Can someone suggest some reading I can do to understand how that works? I can't wrap my head around the idea of subclasses removing functionality. Why not? Is it any weirder than si

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, jerry gay writes: perhaps trey meant "subclasses can add constraints as well as functionality" instead of "subclasses can remove functionality as well as adding it." just a guess. ~jerry Ok... same thing from a DBC perspective. Subclasses can add functiona

Re: clarifying the spec for 'ref'

2006-08-25 Thread jerry gay
On 8/25/06, Trey Harris <[EMAIL PROTECTED]> wrote: In a message dated Fri, 25 Aug 2006, Mark J. Reed writes: > I think the justification for Luke's POV is the number of operations > each class provides. But my perspective agrees with Juerd - > subclasses can remove functionality as well as addi

Re: clarifying the spec for 'ref'

2006-08-25 Thread Trey Harris
In a message dated Fri, 25 Aug 2006, Mark J. Reed writes: I think the justification for Luke's POV is the number of operations each class provides. But my perspective agrees with Juerd - subclasses can remove functionality as well as adding it, and I definitely view "constant" as an add-on modi

Re: clarifying the spec for 'ref'

2006-08-25 Thread Larry Wall
On Fri, Aug 25, 2006 at 08:40:59AM -0400, Mark J. Reed wrote: : On 8/25/06, Juerd <[EMAIL PROTECTED]> wrote: : >You define in terms of functionality, but don't provide an explanation : >for the chosen point of view. One could say that constant arrays protect : >against : >modifications, which nor

Re: clarifying the spec for 'ref'

2006-08-25 Thread Mark J. Reed
On 8/25/06, Juerd <[EMAIL PROTECTED]> wrote: You define in terms of functionality, but don't provide an explanation for the chosen point of view. One could say that constant arrays protect against modifications, which normal arrays don't. Hence, constant arrays do *more*. I think the justific

Re: clarifying the spec for 'ref'

2006-08-25 Thread Juerd
Luke Palmer skribis 2006-08-24 23:57 (-0600): > Let's say our arrays are simple, for argument's sake: With a constant > array, you can: > * get its length > * get the value of an element at an index > With an array, you can: > * get its length > * get the value of an element at an index >

Re: clarifying the spec for 'ref'

2006-08-24 Thread Luke Palmer
On 8/24/06, Mark J. Reed <[EMAIL PROTECTED]> wrote: On 8/24/06, Luke Palmer <[EMAIL PROTECTED]> wrote: > Well, actually Array would be a subtype of Array::Const, not t'other > way round. Why? That makes no sense to me. An Array isn't a variety of constant Array; a constant Array is a variety

Re: clarifying the spec for 'ref'

2006-08-24 Thread Mark J. Reed
On 8/24/06, Luke Palmer <[EMAIL PROTECTED]> wrote: Well, actually Array would be a subtype of Array::Const, not t'other way round. Why? That makes no sense to me. An Array isn't a variety of constant Array; a constant Array is a variety of Array... Anyway, while smart matching with ~~ would

Re: clarifying the spec for 'ref'

2006-08-23 Thread Luke Palmer
On 8/23/06, Larry Wall <[EMAIL PROTECTED]> wrote: you really want: if $a ~~ Array { and that also matches Array::Const, assuming it's derived from Array. Well, actually Array would be a subtype of Array::Const, not t'other way round. That is a little bit disconcerting, because when you s

Re: clarifying the spec for 'ref'

2006-08-23 Thread Larry Wall
On Wed, Aug 23, 2006 at 06:20:55PM -0400, Mark Stosberg wrote: : I noticed in pugs, 'ref' does not return 'HASH' and 'ARRAY' as Perl5 : does, but returns values including 'Hash', 'Array' and 'Array::Const'. Well, first of all, ref is going away entirely, since there's no such thing as a reference

clarifying the spec for 'ref'

2006-08-23 Thread Mark Stosberg
I noticed in pugs, 'ref' does not return 'HASH' and 'ARRAY' as Perl5 does, but returns values including 'Hash', 'Array' and 'Array::Const'. I don't find meaningful mentions of 'HASH' and 'ARRAY' by grep'ing docs/Perl6 (or even "ref"!), so I wanted to check in here about the meaningfulness of this