eval should throw an exception on compile error

2011-05-06 Thread Michael G Schwern
I was just playing around with eval, trying to figure out if you can define an operator overload at runtime (seems you can't, good) and noticed this in the spec... [1] "Returns whatever $code returns, or fails." How does one get the compile error from an eval? What's the equivalent to $@? I

Re: Smooth numeric upgrades?

2008-10-05 Thread Michael G Schwern
So, the concrete use-case I'm thinking of here is currency. Darren Duncan wrote: >> [2] "Num" should have an optional limit on the number of decimal places >> it remembers, like NUMERIC in SQL, but that's a simple truncation. > > I disagree. > > For starters, any "limit" built into a type d

Re: Smooth numeric upgrades?

2008-10-05 Thread Michael G Schwern
TSa (Thomas Sandlaß) wrote: > I want to stress this last point. We have the three types Int, Rat and Num. > What exactly is the purpose of Num? The IEEE formats will be handled > by num64 and the like. Is it just there for holding properties? Or does > it do some more advanced numeric stuff? "Int"

Re: [svn:perl6-synopsis] r14585 - doc/trunk/design/syn

2008-10-05 Thread Michael G Schwern
TSa (Thomas Sandlaß) wrote: > Can't we have that as a general feature of all operators? > That is: > >my ($x, $y); > >say $x * $y; # prints 1 >say $x + $y; # prints 0 > > It is a cleaver idea to make the operator choose an appropriate > value for a Nothing value. Why having that only

Re: Smooth numeric upgrades?

2008-10-05 Thread Michael G Schwern
Darren Duncan wrote: > Patrick R. Michaud wrote: >> Correct. I suspect that eventually the Rakudo developers will have >> to develop a custom set of PMCs for Perl 6 behaviors rather than >> relying on the Parrot ones. > > I think it would be better for things like unlimited-precision integers > a

Re: Smooth numeric upgrades?

2008-10-03 Thread Michael G Schwern
Larry Wall wrote: > On Fri, Oct 03, 2008 at 11:57:30PM -0400, Michael G Schwern wrote: > : What's the status of numeric upgrades in Perl 6? Is see the docs say "Perl > 6 > : intrinsically supports big integers and rationals through its system of type > : declarations. I

Smooth numeric upgrades?

2008-10-03 Thread Michael G Schwern
What's the status of numeric upgrades in Perl 6? Is see the docs say "Perl 6 intrinsically supports big integers and rationals through its system of type declarations. Int automatically supports promotion to arbitrary precision" but it looks like it's doing the same thing as Perl 5. $ ./perl6 -e

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-25 Thread Michael G Schwern
David Green wrote: > I bet we actually don't disagree much; I'm not really against "ro" -- > I'm just not against "readonly" because of its length. If I were > writing casually, I'd use "rw" and "ro"; formally, I'd use "read only" > and "read/write" (or even "readable and writable"). At an in-bet

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread Michael G Schwern
David Green wrote: > On 2008-Sep-23, at 2:32 pm, Michael G Schwern wrote: >> My other thought is that since parameters are read-only by default >> it's not >> thought you'd have to write it much so clarity wins out over brevity, >> the flip >> side of H

Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread Michael G Schwern
John M. Dlugosz wrote: > I'm not opposed to having it be "ro", but wonder why he didn't call it that > in the first place, so there must be a reason. Nobody's perfect? My other thought is that since parameters are read-only by default it's not thought you'd have to write it much so clarity wins o

Re: Subroutine parameter with trait and default.

2008-09-22 Thread Michael G Schwern
Patrick R. Michaud wrote: > On Sun, Sep 21, 2008 at 07:02:37PM -0700, Michael G Schwern wrote: >> I'm pondering what the proper syntax is for a subroutine parameter with both >> a >> trait and a default. That is... >> sub foo ($arg = 42) >> and >>

Subroutine parameter with trait and default.

2008-09-21 Thread Michael G Schwern
I'm pondering what the proper syntax is for a subroutine parameter with both a trait and a default. That is... sub foo ($arg = 42) and sub foo ($arg is readonly) together in one parameter. Would that be sub foo ($arg = 42 is readonly) or sub foo ($arg is rea

Re: Deep equivalence test of data structures

2008-09-14 Thread Michael G Schwern
Eric Wilhelm asked me to chime in here. is_deeply() is about checking that two structures contain the same values. This is different from checking that they're the same *things*, that they are in fact the same object or reference. You need both. Reading eqv() it seems that yes, it is doing like

Re: Concerns about "{...code...}"

2007-12-21 Thread Michael G Schwern
Larry Wall wrote: > But I will make one general remark at the start, which is that we > want Perl 6 programmer to look at curlies differently than Perl 5 > programmers do. In Perl 5, curlies were overloaded many different > ways, and rarely did they mean a closure by themselves. In Perl 6, > it's

Re: Concerns about "{...code...}"

2007-12-21 Thread Michael G Schwern
John Siracusa wrote: > On 12/21/07 5:54 AM, Larry Wall wrote: >> To you and me, the fact that there are single quotes means there's >> something there to hide. But other people think the other way and >> see double quotes as indicating there's something to interpolate. >> I think PBP comes down on

Re: Concerns about "{...code...}"

2007-12-20 Thread Michael G Schwern
oreach syntax, for instance. > (Though I disagree with the conflation of numeric and associative > arrays, a flaw shared by JavaScript.) > > > On 12/20/07, Michael G Schwern <[EMAIL PROTECTED]> wrote: >> Patrick R. Michaud wrote: >>> Just to add another persp

Re: Concerns about "{...code...}"

2007-12-20 Thread Michael G Schwern
Jonathan Scott Duff wrote: > On Thu, Dec 20, 2007 at 07:58:51AM -0500, Mark J. Reed wrote: >> I think the issue is that bare vars don't interpolate anymore, but >> they still have sigils of their own, so adding to the default interp >> syntax is too noisy: ${$var} is not really much improvement ov

Re: Concerns about "{...code...}"

2007-12-20 Thread Michael G Schwern
Patrick R. Michaud wrote: > Just to add another perspective, PHP uses curlies inside of > double-quoted strings to indicate various forms of > interpolation, and it doesn't seem to cause major issues > there. PHP has 8000 built in functions and it doesn't seem to cause issues there. I'll not be t

Concerns about "{...code...}"

2007-12-19 Thread Michael G Schwern
I was reading an article about Perl 6, I forget which one, and it happened to mention that code can be interpolated inside double quoted strings. That's one thing, my concern is with the selected syntax. say "foo { 1+1 }"; # "foo 2" The {...} construct seems far too common one in norma

Re: no 6;

2005-09-11 Thread Michael G Schwern
orted due to compilation errors. $ perl1 -e 'no 4; print "Happy New Year, 1988!\n"' syntax error in file /tmp/perl-eE52cHQ at line 1, next token "string" Execution aborted due to compilation errors. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobo

Re: Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-16 Thread Michael G Schwern
On Fri, Apr 15, 2005 at 09:32:23PM -0400, Chip Salzenberg wrote: > > Perl 6 is going to have to decide on some sort of standard internal getcwd > > technique, $CWD or not. > > I don't think Perl 6 "has" to do anything of the kind. It would > be a mistake to try. Sorry, I had assumed that having

Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-15 Thread Michael G Schwern
On Fri, Apr 15, 2005 at 08:31:57PM -0400, Chip Salzenberg wrote: > According to Michael G Schwern: > > And this is exactly what File::chdir does. $CWD is a tied scalar. > > I don't think current directory maps well on a variable. That won't > stop peo

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
On Fri, Apr 15, 2005 at 11:52:38PM +0200, Juerd wrote: > > becomes an unverifiable operation. You have to use chdir() if you want to > > error check and $CWD is reduced to a "scripting" feature. > > Well, after failure it can be cwd() but false without breaking any real > code, because normally,

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
Thus spake Larry Wall: > Offhand, I guess my main semantic problem with it is that if a chdir > fails, you aren't in an undefined location, which the new value of $CWD > would seem to indicate. You're just where you were. Then the user > either has to remember that, or there still has to be some

$*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
I was doing some work on Parrot::Test today and was replacing this code with something more cross platform. # Run the command in a different directory my $command = 'some command'; $command= "cd $dir && $command" if $dir; system($command); I replaced it with th

Re: .method == $self.method or $_.method?

2005-03-18 Thread Michael G Schwern
[ Sorry if my replies to this thread have seemed a little disjoint. I just realized I'd unsubscribed myself from p6l last year when I started a $job$ and never resubscribed. So I'd only been seeing fragments of the conversation. Catching up from the archives... ] Larry's idea of making $

Re: .method == $self.method or $_.method?

2005-03-18 Thread Michael G Schwern
This drifed off list but I don't think that was intentional. - Forwarded message from Yuval Kogman <[EMAIL PROTECTED]> - From: Yuval Kogman <[EMAIL PROTECTED]> Date: Fri, 18 Mar 2005 01:12:42 +0200 To: Michael G Schwern <[EMAIL PROTECTED]> Subject: Re: .me

Re: .method == $self.method or $_.method?

2005-03-18 Thread Michael G Schwern
On Thu, Mar 17, 2005 at 11:46:52PM +0200, Yuval Kogman wrote: > I think this should mean $_, and if the user really really really > wants to do .foo on the invocant, then why not just say: > > method bar ($_:) { > .foo; > } Because $_ can change. method bar ($_:) {

Re: .method == $self.method or $_.method?

2005-03-17 Thread Michael G Schwern
On Thu, Mar 17, 2005 at 07:00:08PM +1100, Adam Kennedy wrote: > The only minor thing I > can see would be that you will end up with a slight asymmetry question > of "if we use $:attribute for a private attribute, do we call :method > for a private method?" That occurs no matter if .method means

Re: .method == $self.method or $_.method?

2005-03-17 Thread Michael G Schwern
On Thu, Mar 17, 2005 at 06:04:56PM +1100, Adam Kennedy wrote: > I should add that Darren and I, who both have similar tendencies towards > larger scale coding where consistency is far preferred to compactness, > both ended up concluding that our style policies will be to _always_ use > explicit

.method == $self.method or $_.method?

2005-03-17 Thread Michael G Schwern
There's a discussion going on #perl6/irc.freenode.org right now wondering about what .method means. We'd all assumed it meant $self.method (where $self is always the method invocant) but then had a look at Synopsis 12 which states Dot notation can omit the invocant if it's in $_: .doit(1

Re: OO inheritance in a hacker style

2004-01-28 Thread Michael G Schwern
not be the right thing. Consider delegation instead. -- Michael G Schwern[EMAIL PROTECTED] http://www.pobox.com/~schwern/ You're more radiant than a memory of breathtaking ecstasy.

Re: 'Core' Language Philosophy [was: Re: 'catch' statement modifier]

2003-11-27 Thread Michael G Schwern
will be MUCH easier to install. :) -- Michael G Schwern[EMAIL PROTECTED] http://www.pobox.com/~schwern/ Cottleston, Cottleston, Cottleston Pie. A fly can't bird, but a bird can fly. Ask me a riddle and I reply: "Cottleston, Cottleston, Cottleston Pie."

Re: The C Comma

2003-11-24 Thread Michael G Schwern
t; in their heads. I'm one of them. Its not a previous syntax thing, its a translation to English thing. This may be a consequence of the example used while $n++ then $foo > $bar which I immediately associated with. if $n++ then $foo > $bar I didn't say it makes s

Re: The C Comma

2003-11-24 Thread Michael G Schwern
"if/then" which is confusing. Its exactly the opposite from what you're trying to convey. It also doesn't convey anything about "evaluate the left hand side, ignore the results and evaluate the right". Unfortunately, I don't have a better name. -- Michael G Schwern[EMAIL PROTECTED] http://www.pobox.com/~schwern/ Now we come to that part of the email you've all been waiting for--the end.

Re: Apocalypses and Exegesis...

2003-08-14 Thread Michael G Schwern
? Its scheduled to occur shortly following Hell. ;) -- Michael G Schwern[EMAIL PROTECTED] http://www.pobox.com/~schwern/ WOOHOO! I'm going to Disneyland! http://www.goats.com/archive/980805.html

Re: %_ - is it available for use?

2003-08-02 Thread Michael G Schwern
On Sat, Aug 02, 2003 at 08:16:19PM -0700, Larry Wall wrote: > On Sat, Aug 02, 2003 at 04:33:19PM -0700, Michael G Schwern wrote: > : I'm not making an argument against %_, just noting that *_ is used > : opportunisticly and you will break a few programs. > > Not necessarily

Re: %_ - is it available for use?

2003-08-02 Thread Michael G Schwern
On Sun, Aug 03, 2003 at 01:37:16AM +0200, Abigail wrote: > I am fond of doing > > local %_ = @_; > > as one of the first statements of a subroutine. That, or > > my %args = @_; > > I like the latter because it uses a lexical variable, but I like the > former because %_ fits with @_ and

Re: %_ - is it available for use?

2003-08-02 Thread Michael G Schwern
> Damian Conway <[EMAIL PROTECTED]> writes: > >Hence, making C<%_> mean something different in core Perl 5 might possibly be > >"forwards incompatible". Representing the Backwards Compatiblity Police, I've had co-workers use %_ as the globalist of all global hashes. %_ transends all packages and

Re: How shall threads work in P6?

2003-03-31 Thread Michael G Schwern
On Mon, Mar 31, 2003 at 08:13:09PM +0200, Matthijs van Duin wrote: > I think we should consider cooperative threading, implemented using > continuations. Yielding to another thread would automatically happen when > a thread blocks, or upon explicit request by the programmer. > > It has many adv

Re: Spare brackets :-)

2003-01-29 Thread Michael G Schwern
/www.php.net/manual/en/language.types.array.php So that makes a nice case study to investigate. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One

Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
On Thu, Jan 09, 2003 at 11:15:49PM -0500, John Siracusa wrote: > On 1/9/03 10:10 PM, Michael G Schwern wrote: > > I would assume it to be a compiler hint via subroutine attribute. > > > > sub debug ($msg) is off { > > print STDERR $msg; > > } > > &g

Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
e. sub debug ($msg) is off { print STDERR $msg; } some "this subroutine is a no-op if a flag is set" attribute. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One

Re: tree frobbing facilities in Perl6?

2002-12-24 Thread Michael G Schwern
0 (For this example I put the top level "ps:" back into the YAML so it would translate better into XML) xyx is just a really thin wrapper around YAML.pm and XML::Simple. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance

Re: tree frobbing facilities in Perl6?

2002-12-24 Thread Michael G Schwern
ing a lot of code. Am I missing something? I think your external format (XML which is a tree) is not mapping well to your internal format (Perl which uses hashes,arrays and scalars) causing you to have to shuffle your awkward XML->tree structure into something more Perlish. By pic

Re: Everything is an object.

2002-12-18 Thread schwern
On Tue, Dec 17, 2002 at 09:48:56AM -0500, Dan Sugalski wrote: > >Simon Cozens wrote: > >> Once again we're getting steadily closer to inventing Ruby. > > > >Agreed, but I don't think this is necessarily a Bad Thing. > > Disagreed--we're getting steadily closer to inventing Smalltalk. :) Silly r

Re: Everything is an object.

2002-12-17 Thread schwern
On Tue, Dec 17, 2002 at 03:12:09AM -0600, Josh Jore wrote: > > This is just your friendly neighborhood curmudgeon reminding you that in > > Perl 6, everything is an object. This is a concept that, as Perl > > programmers, we're not familiar with. > > Are these objects class based or where do the

Re: Everything is an object.

2002-12-12 Thread Michael G Schwern
w style worth keeping. @out = join "\n", map {...} grep {...} sort {...} @foo -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Pancakes is the better part of valor. http://www.goats.com/archive/971202.html

Re: Everything is an object.

2002-12-11 Thread Michael G Schwern
g Ruby as a rough guide, there aren't many of those. http://www.rubycentral.com/book/ref_c_object.html -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One One disease, long life. No disease, short life.

Everything is an object.

2002-12-11 Thread Michael G Schwern
go grammar happy. In closing: Consider a method rather than a built-in or operator. Everything is an object. Tattoo it on your forehead today. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]>

Re: Comparing Object Identity (was: Re: Stringification of references (Decision, Please?))

2002-12-11 Thread Michael G Schwern
s @bar; > > $obj1 eq $obj2;# [1] are their stringifications identical? > > $obj1 == $obj2;# [2] are their numifications identical? > > $obj1 === $obj2; # [3] are they in fact the same object? -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pob

Re: Partially Memoized Functions

2002-12-10 Thread Michael G Schwern
e generally useful or not, which is why I asked here, for > an increased sample size. > > And that increased sample size indicates "not", so I'll forget about it. I dunno, my motto is "never hurts to put it in a library". -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One MERV GRIFFIN!

Re: Partially Memoized Functions

2002-12-09 Thread Michael G Schwern
my $leap = $year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0); return $leap ? 29 : 28; } Of course there's nothing which says you can't just do *both*. cache_and_return() is merely a function. Write it, stick it in a library, distribute for fun and/or

In defense of zero-indexed arrays.

2002-12-05 Thread Michael G Schwern
...) in Perl 6 start at 0 will benefit most users. Do not invoke legacy. [1] [1] ie. "because that's how most other languages do it" or "everyone is used to it by now" are not valid arguments. Ask any Pascal programmer. :) -- Michael G. Schwern <[EMAIL PROTE

Re: seperate() and/or Array.cull

2002-12-04 Thread Michael G Schwern
{ /condition/ ? $i++ : () } @stuff; Its so rare that you work by array index in Perl. Usually things flow together element by element. Sort of like how you rarely handle strings character by character which can severely confuse C programmers. What was your friend trying to do? -- Michael

seperate() and/or Array.cull

2002-12-04 Thread Michael G Schwern
dditional way to do it would be as an Array method. @switches = @ARGV.cull /^-/; Array.cull would remove and return a list of every element in @ARGV which matched. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL P

Re: String concatentation operator

2002-11-14 Thread Michael G Schwern
hive.develooper.com/perl6-language@;perl.org/msg06639.html "YAYAYA string concat proposal" http://archive.develooper.com/perl6-language@;perl.org/msg06650.html "a modest proposal Re: s/./~/g" http://archive.develooper.com/perl6-language@;perl.org/msg06672.html -- Michael G.

Re: String concatentation operator

2002-11-14 Thread Michael G Schwern
o? In Perl 5 it stops at a sane point: $ perl -wle 'print "bar" + "foo"' Argument "foo" isn't numeric in addition (+) at -e line 1. Argument "bar" isn't numeric in addition (+) at -e line 1. 0 Ok, so string + string does somet

Re: Indeterminate math

2002-10-18 Thread Michael G Schwern
sis of what happens when you try to introduce infinity into the real number system, see: http://mathforum.org/library/drmath/view/55764.html -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job O

Re: Indeterminate math

2002-10-15 Thread Michael G Schwern
oops ... } } (putting aside that exception handlers stack). Whatever you call it, exception or error, it will halt the program if left unhandled. [1] Less the few odd really hard core "the interpreter is having a bad trip" sort of errors. -- Michael G. Schwern <[EM

Re: Indeterminate math

2002-10-14 Thread Michael G Schwern
On Mon, Oct 14, 2002 at 08:25:43PM -0400, Mark J. Reed wrote: > On 2002-10-14 at 20:15:33, Michael G Schwern wrote: > > There are several verbal proofs why 1/0 is not +Infinity here: > > http://mathforum.org/dr.math/faq/faq.divideby0.html > > Yeah, that would be why I sent

Re: Indeterminate math

2002-10-14 Thread Michael G Schwern
dr.math/faq/faq.divideby0.html -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Plus I remember being impressed with Ada because you could write an infinite loop without a faked up con

Re: Indeterminate math

2002-10-14 Thread Michael G Schwern
ated will be a concept in Perl6. What happens when NaN is used in an expression? Is NaN + 0 == NaN? -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One 11. Every old idea will be

Re: untaintby property

2002-10-14 Thread Michael G Schwern
mething in the family of your original /T regex proposal would make more sense. Attack the problem at its source. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Do you have a map? Because I keep getting lost in your armpits.

Indeterminate math

2002-10-14 Thread Michael G Schwern
the denominators might be zero, you can just see if the result is undef. [1] I apologize for forgetting who. [2] Discussion of divide by zero and why it's not infinity [3] http://mathforum.org/dr.math/faq/faq.divideby0.html [3] I was always taught it's infinity. -- Michael G. Schwern

Re: Fw: perl6 operator precedence table

2002-10-09 Thread Michael G Schwern
ne: print defined? $foo; This is a syntax error: print defined? $foo : 42; /home/schwern/tmp/foo.rb:1: parse error print defined? $foo : 42; ^ -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance

Re: Interfaces

2002-10-08 Thread Michael G Schwern
mmon and can be used for Good or Evil. [1] It would be less worse [2] as a compile-time exception. [2] This is different than "better". ;) -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One I don't get it. Must be art.

Re: Interfaces

2002-10-08 Thread Michael G Schwern
e method implementations, just not with an interface contract. Unfortunately, Java doesn't ship with JUnit nor do Java libraries usually ship with tests nor does a simple convention to run them nor an expectation that the user will run the tests before installing. Score one for Perl. :)

Re: Interfaces

2002-10-08 Thread Michael G Schwern
ught to be one of those "sure you can do this, but please don't" things. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One You see, in this world

Re: Interfaces

2002-10-06 Thread Michael G Schwern
ains(Object o)   Returns true if this collection contains the specified element. I don't know basic Java syntax worth a damn, but I know its dirty little secrets. ;) -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One It's Absinthe time!

Re: Private contracts?

2002-10-04 Thread Michael G Schwern
example, but now I can't find it and I can't remember what it was. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One It sure is fun masturbating. http://www.unamerican.com/

Slots [was Re: Draft Proposal: Attributes: "public" vs. "private"]

2002-10-04 Thread schwern
ven above may be what many programmers expect, and may be more in > line with perl's philosophy. It seems especially wonky to allow the > cootie-infested "public" but not allow the more liberal interpretation > of "private". This sounds like "two wrongs make a right" to me. -- Michael G Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One

Re: We need an OO issue list & tutorial!

2002-10-04 Thread schwern
t; > (OO Articles 6) Also considered drop-deads: interfaces, assertions (of > > various sorts), multiple inheritance, complex delegation. > > > > Can we at least agree on these? Are there other basic tenets that > > should be included? > > Bravo! Me, too! -

Re: Private contracts?

2002-10-04 Thread schwern
t technique, I think one was already mentioned where subclasses can unintentionally weaken preconditions to the point of eliminating them. I'm sort of casting about looking for another way. -- Michael G Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One

Re: Private contracts?

2002-10-04 Thread schwern
nor Java background, so to me "interface" just means "how you use the thing" and it happens to be inherited. I think you're reading more into it than my deliberately simplistic definition. The other part that's up in the air is if method signatures will be enforced on

Re: Private contracts?

2002-10-04 Thread schwern
postconditions. In essence, you're not requiring any more of > the client, but you can ensure more to them on completion, thus > maintaining the parent's contract. But what does it mean to be "stronger"? How does Eiffel figure out if a given precondition is "stronger&q

Re: Delegation syntax?

2002-10-03 Thread Michael G Schwern
be good > here. Delegation is a basic OO technique. We definately should have fast, well-designed core support for it. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Is there an a

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
sarily require subclasses to do anything, at least not in Perl. So an interface is simply a class, maybe abstract, which requires its subclasses to conform to its signature. At least that's how I see it. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~sch

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 07:23:14PM -0400, Michael G Schwern wrote: >invar { .shoulders == .knees == .toes == 2 } This may explain why I can only count to 12 with my shoes off. As this is my 3rd reply to myself in the thread, I'll call it a night. :) -- Michael G. Schwern

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 03:54:09PM -0700, Michael Lazzaro wrote: > I have no *good* syntax proposals for this, I don't think I've ever > seen the problem solved with syntax that I really ever liked. Class::Delegation? -- Michael G. Schwern <[EMAIL

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 06:46:14PM -0400, Michael G Schwern wrote: > I see us already smashing too many things into the method signature as it > is. It will rapidly get messy if you have a method with a complex signature > and a handful of attributes and preconditions. I think I ha

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
te check and not a documented feature of the object. A clearer example might be something like checking that an internal data structure used by the object is not circular. A class invariant, yet not something I want to enforce on my children. They're tools that when combined form an "inte

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 05:30:49PM -0400, Trey Harris wrote: > In a message dated Thu, 3 Oct 2002, Michael G Schwern writes: > > > On Thu, Oct 03, 2002 at 03:59:08PM -0400, Mike Lambert wrote: > > > With pre/post conditions, a subclass is allowed to weaken the > > &g

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
ould be pretty simple to teach and remember, "conditions and invariants are inherited unless made private". -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One It's Flypaper Licking time!

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
r, etc...) use all cap names. At least I hope not. Simply attaching an "is private" attribute to a pre condition block seems the simplest way to go about it. Just like any other private thing, it's not inherited and not visible outside the current class. "pre" vs &

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 04:54:13PM -0500, Garrett Goebel wrote: > Garrett Goebel: > > Michael G Schwern: > > > But I don't want my subclasses to be constrained by that. > > > It's just an implementation detail that I only wish to > > > enforce upon

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 03:59:08PM -0400, Mike Lambert wrote: > With pre/post conditions, a subclass is allowed to weaken the > preconditions or strengthen the postconditions. How exactly does one "weaken" a precondition? -- Michael G. Schwern <[EMAIL PROTECTED]>

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 03:45:33PM -0500, Allison Randal wrote: > On Thu, Oct 03, 2002 at 03:00:21PM -0400, Michael G Schwern wrote: > > On Thu, Oct 03, 2002 at 02:46:38PM -0400, Michael G Schwern wrote: > > > class ATV is Car, interface { > > > >

Re: Private contracts?

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 02:46:38PM -0400, Michael G Schwern wrote: > class ATV is Car, interface { Hmmm. That should probably be class ATV isa Car is interface { -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance

Private contracts?

2002-10-03 Thread Michael G Schwern
mentation detail that I only wish to enforce upon ATV and not it's children. So they're private. Makes sense, no? -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Remember, any tool can be the right tool. -- Red Green

Re: Interfaces

2002-10-02 Thread Michael G Schwern
ions on a method would be treated, > internally, as part of the overall signature/prototype of the method: > i.e. if you override the method in a subclass, all original > postconditions would still remain attached to it (though the new method > might itself add additional postcondit

Re: Interfaces

2002-10-02 Thread Michael G Schwern
al solution much better. When you use your MP3 Car as a Vehicle, the Vehicle methods win. When you use it like an MP3_Player, the MP3_Player methods win. No need to expose the underlying MP3_Player object to the user. YMMV. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobo

Re: Interfaces

2002-10-02 Thread Michael G Schwern
ubclasses by default, or if you have to explicitly declare yourself to be an interface. That's up in the air in my mind. Orthoginal to that decision is if a subclass should be able to explicitly ignore its parent's interface and conditions. I started by leaning towards yes, now I'm

Re: Interfaces

2002-10-01 Thread Michael G Schwern
aliasing doesn't solve this? Ahh, because Perl has to know that when $mover is used as a Vehicle it uses Car.accel but when used as an MP3_Player it calls Car.mp3_drive. Clever! -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance

Re: Interfaces

2002-10-01 Thread Michael G Schwern
e up with a practical case of adding parameters which violates the interface, I'd say there's no problem, strict or no strict. > My musing is that the behavior of a class in different contexts is > itself an interface, in the sense of being a contract between a > class/subclass and it

Subject-Oriented Programming

2002-09-30 Thread Michael G Schwern
ls to really describe it well. So since this list is a magnet for folks who know obscure programming techniques, is there anyone out there familiar enough with SOP that they could lay out some examples in pseudo-perl? -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~sc

Re: Interfaces

2002-09-30 Thread Michael G Schwern
of the method itself, or it's name? In other words, do aliases to the same method carry the same signature and attributes? > Oh yes, and we need to make sure DBC stuff is part of the interface, not > the implementation. Sensible. -- Michael G. Schwern <[EMAIL PROTECTED]>

Interface lists (was Re: Interfaces)

2002-09-30 Thread Michael G Schwern
On Tue, Oct 01, 2002 at 01:36:19AM +0100, Simon Cozens wrote: > [EMAIL PROTECTED] (Michael G Schwern) writes: > > method _do_internal_init ($num) is private { > > Just thinking aloud, would > sub foo is method is private is integer is fungible { > &

Re: Interfaces

2002-09-30 Thread Michael G Schwern
do we say the interface can > only return object classes derived from that first object class? Yes. The object class is simply a return type. > And do we restrict the possible "flattenings" of the object class itself, > using an interface, so subclasses of the returned ob

Interfaces

2002-09-29 Thread Michael G Schwern
ill use for optional arguments, so I'll just use the Perl 5 style. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Do you have a map? Because I keep getting lost in your armpits.

  1   2   3   4   5   >