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
Richard Hainsworth skribis 2006-08-28 10:33 (+0400):
> ---
> | Class
> A|
> |
> --
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
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
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
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
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
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
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
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.
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
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
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
> 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
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 <[
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
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
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
> 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
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
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
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
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
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
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
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
>
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
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
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
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
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
31 matches
Mail list logo