Multmethods by arg-value

2002-12-10 Thread David Whipp
I was reading the Partially Memorized Functions thread, and the thought came to mind that what we really need, is to define a different implementation of the method for a specific value of the arg. Something like: sub days_in_month( Str $month, Int $year ) { ... } sub days_in_month( Str $month

RE: Usage of \[oxdb]

2002-12-04 Thread David Whipp
I think that solves all the problems we're having. We change \c to have more flexible meanings, with \0o, \0x, \0d, \0b, \o, \x as shortcuts. Boom, we're done. Thanks! How far can we go with this \c thing? How about: print \c[72, 101, 108, 108, 111]; will that print Hello? Dave.

RE: purge: opposite of grep

2002-12-04 Thread David Whipp
Miko O'Sullivan [mailto:[EMAIL PROTECTED]] wrote: SUMMARY Proposal for the purge command as the opposite of grep in the same way that unless is the opposite of if. I like it. But reading it reminded me of another common thing I do with grep: partitioning a list into equivalence classes.

Primitive Vs Object types

2002-11-06 Thread David Whipp
Every primitive type has an associated object type, whose name differs only by capitalized first letter. A few posts back, Larry mentioned that perhaps similar things should look different: this may be a good case to apply this principle. Whenever a value passes through a primitive type, it loses

RE: Primitive Vs Object types

2002-11-06 Thread David Whipp
Dan Sugalski [mailto:dan;sidhe.org] wrote: At 6:50 PM -0800 11/6/02, David Whipp wrote: Whenever a value passes through a primitive type, it loses all its run-time properties; and superpositions will collapse. What makes you think so, and are you really sure? I was sure up until

RE: Primitive Vs Object types

2002-11-06 Thread David Whipp
Dan Sugalski [mailto:dan;sidhe.org] wrote: At 8:24 PM -0800 11/6/02, David Whipp wrote: If I am wrong, then I am in need of enlightenment. What is the difference between the primitive types and their heavyweight partners? And which should I use in a typical script? The big difference

RE: Primitive Boolean type?

2002-11-01 Thread David Whipp
David Wheeler [mailto:david;wheeler.net] wrote: The problem with this is that you have explicitly introduced true and false into the language, and have therefore destroyed the utility of context: my boolean $bool = 0; # False. my $foo = ''; # False context. if ($foo eq

RE: [RFC] Perl6 Operator List, Take 5

2002-10-29 Thread David Whipp
Larry Wall [mailto:larry;wall.org] wrote: : unary (postfix) operators: :... - [maybe] same as ..Inf [Damian votes Yes] I wonder if we can possibly get the Rubyesque leaving out of endpoints by saying something like 1..!10. Perhaps we could use the less-than symbol: 1 .. 10

RE: Perl6 Operator List, Damian's take

2002-10-29 Thread David Whipp
Luke Palmer [mailto:fibonaci;babylonia.flatirons.org] wrote: for x | y - $x is rw | $y { $x += $y } This superposition stuff is getting to me: I had a double-take, wondering why we were iterating with superpositions (Bitops never entered my mind). Did the C; ever

RE: Character Properties

2002-10-21 Thread David Whipp
Jonathan Scott Duff wrote: Ok, how about this: Is there a reason Inot to? Or should I not go there? Off hand, it sounds expensive. I don't see a way to only let the people who use it incur the penalty, but my vision isn't the best in the world. It should be possible to define the

RE: Indeterminate math

2002-10-14 Thread David Whipp
Mark J. Reed wrote: I realize the above is mathematically simplistic. The real reason y = x/0 returns an error is because no matter what value you assign to y, you aren't going to get x back via multiplying y by 0. Well, that may be true in math; but there's no reason why it has to be true

RE: Lukasiewiczian logic (was Indeterminate math)

2002-10-14 Thread David Whipp
it looks like Lukasiewiczian NULL is just the nifty NULL that SQL has, and the nifty ways that it affects logical and aggregate operations. Actually, something I wouldn't mind seeing in other languages -- I can't say if perl is one of those, but if it can be provided by expansion, that would

RE: Private contracts?

2002-10-04 Thread David Whipp
Michael G Schwern [EMAIL PROTECTED] wrote: I can see too many problems with that technique, I think one was already mentioned where subclasses can unintentionally weaken preconditions to the point of eliminating them. Which is, of course, why we OR them, yet AND the postconditions It is

RE: Interfaces

2002-09-30 Thread David Whipp
Michael Lazzaro wrote: What if a subclass adds extra, optional arguments to a method, is that ok? This is the scariest question, I think... In theory, yes, there are lots of potential interfaces that would benefit from optional extensions, I've made a few. In strict terms, though,

RE: Security model for Perl with good support in Parrot (Safe/Opc ode etc.)

2002-09-27 Thread David Whipp
Kv Org [mailto:[EMAIL PROTECTED]] wrote I believe Perl6 needs a facility to run compartmented code (object-oriented and module-loading) that is tagged as to its permissions and owner ID. The goal would be to let such code use harmful actions only by calling permitteed outside functions that

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
It seems that the fundamental problem is the dichotomy between a scalar, and a list of 1 elem. Thus, we want $a = 7 to DWIM, whether I mean a list, or a scalar. Seems to me that the best way to solve a dichotomy is to declare it to not to be one: a scalar *IS* a list of one element. The only

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
From: Jonathan Scott Duff $b = 7, 6, 5 b = 7, 6, 5 Again, both create identical objects, under different interfaces. But now we have a problem with +$b: what should this mean? To be consistant with +$a (above), I would suggest that it simply returns the sum of its elements

RE: Regex query

2002-09-20 Thread David Whipp
Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 #

RE: XS in Perl 6

2002-09-12 Thread David Whipp
Aaron Sherman [mailto:[EMAIL PROTECTED]] wrote: I'm thinking XS thoughts because we're going to need a few external things at SOME point It would be so nice if Perl 6's XS was part of the language, rather than an external pre-processor. [ some interesting stuff] Thoughts? Its good to

RE: @array = %hash

2002-08-30 Thread David Whipp
Steffen Mueller %hash4 = (Something, mixing, pairs = and, scalars); 1 23 4 5 Perl5 says Odd number of elements in hash assignment at -e line 1. And Perl6 should, too. Hmm, I rather like the idea of thinking of a %foo variable as a set, not a

RE: @array = %hash

2002-08-30 Thread David Whipp
Piers Cawley wrote: Maybe we should just say 'sod it' and implement the entire Smalltalk Collection hierarchy and have done with it? Sets, bags, hashes (dictionaries for the Smalltalker), whatever, all have their uses... I'm not sure if you were being facetious, but I do think all the

RE: rule, rx and sub

2002-08-28 Thread David Whipp
Thom Boyer [mailto:[EMAIL PROTECTED]] wrote: sub while (bool $test, body); sub while (test, body); But neither of these really works. The first would imply that the test is evaluated only once (and that once is before 'sub while' is even called). That'd be useless. It

RE: Autovivi

2002-08-14 Thread David Whipp
Luke Palmer wrote: Since variables are copy-on-write, you get the speed of pass-by-reference with the mutability of pass-by-value, which is what everyone wants. If you have this, why would you want to do enforced const reference? That's not rhetorical; I'm actually curious. One reason I

Use of regular expressions on non-strings

2002-08-01 Thread David Whipp
I'm wondering if Perl6's new regex can be applied to non-string things. I seem to recall A5 mentioning something about strings tied to array implementations; but I'm wanting something a little more powerful. A bit of context: I use Perl for verification of big complex ASICs. We run a simulation

RE: Grammar ambiguities again (was: Perl 6 Summary for week ending 20020714)

2002-07-15 Thread David Whipp
Brent Dax wrote: $href = hash { %hash }; #B Why the curlies? if Chash is a function (ctor), then surely these should be parentheses. In this context, parentheses are optional, so this could be written $href = hash %hash; Dave.

A5: thread safety of matching

2002-06-05 Thread David Whipp
As always, most of it is great. so only the niggles get discussed. On page 7, the following example is given: $oldpos = pos $string; $string =~ m/... ( .pos == $oldpos ) .../; This implies that match position is associated with the string. This worries me. If 2 threads are matching on

A5: hypotheticals outside regexen

2002-06-05 Thread David Whipp
Page 13 tells use about Clet decls. But it also says that the topic must be a regex. Whilst it explains that this isn't really a problem, I'm not sure that it justifies it. So perhaps someone can clarify why this (hypothetical) code in not a reasonable generalization: our $foo = 0; sub

A5: a few simple questions

2002-06-05 Thread David Whipp
First, a slight clarification: if I say: m:w/ %foo := [ (\w+) = (\w+) [ , (\w+) ]* ] / does this give me a hash of arrays? (i.e. is the rhs of a hash processed as a scalar context) When I look at this, I see a common pattern: the join/split concept. It feels like there should be a standard

RE: Accessor methods ?

2002-05-10 Thread David Whipp
Damian Conway [mailto:[EMAIL PROTECTED]] wrote: .bar is the auto-created accessor for $.bar, so they should do the same thing, no? Presumably, but perhaps not quite as fast. Assuming some subclass has not overridden .bar() Dave.

RE: FIRST, BETWEEN, etc.. (was Re: Loop controls)

2002-05-09 Thread David Whipp
Aaron Sherman [mailto:[EMAIL PROTECTED]] wrote: what about while (do_something_with_side_effects_and_check_still_ok()) { I presume we don't want to do look-ahead here. Yes, I think he was saying exactly that we will do look-ahead here. we don't guarantee order of evaluation

RE: FIRST, BETWEEN, etc.. (was Re: Loop controls)

2002-05-09 Thread David Whipp
Miko O'Sullivan wrote: Just checking here: is PRE_LAST a separate and non-mutually exclusive concept from LAST? I.e., would this make sense: foreach arr - $i { PRE_LAST {print before last loop\n} LAST {print after last loop\n} print $i\n; } If so, wouldn't

RE: Loop controls

2002-05-06 Thread David Whipp
Miko O'Sullivan [mailto:[EMAIL PROTECTED]] wrote: Sorry, I thought I'd expressed agreement at some point. I like the else\s+(if|while|for|loop) construct very much, and I think the programmers of the world would like it too. I know a some people have issues with where's the if but it's no

RE: Loop controls

2002-05-03 Thread David Whipp
Damian Conway wrote: BUGS Unlikely, since it doesn't actually do anything. However, bug reports and other feedback are most welcome. Bug: don't { die } unless .error; doesn't DWIM (though the current behavour, do nothing, is logically correct). Dave.

RE: Unary dot

2002-04-10 Thread David Whipp
Mark J. Reed wrote: On Wed, Apr 10, 2002 at 10:30:25AM -0700, Glenn Linderman wrote: method m1 { m2; # calls method m2 in the same class Yes, but does it call it as an instance method on the current invocant or as a class method with no invocant? If the former, how would you do the

RE: Unary dot

2002-04-10 Thread David Whipp
Mark J. Reed wrote On Wed, Apr 10, 2002 at 03:03:45PM -0400, Mark J. Reed wrote: ..class.m2: # call static m2 within m1's class, regardless of how m1 was called Typo. That should be just .class.m2, only one leading '.'. Wouldn't that be the current topic's class? Dave.

RE: Unary dot

2002-04-10 Thread David Whipp
Piers Cawley This may be a case of keep up at the back, but if that is a method call, how do I call a subroutine from within a method ? [...] Yes, I know there's several different ways I could do it, but this approach feels right. I think this comes does to huffmann encoding: which

RE: Unary dot

2002-04-10 Thread David Whipp
Melvin Smith wrote I think that would be just plain bad design, but I'd be happy if someone showed me a use for it. :) well, I've been known to do sub UNIVERSAL::debug { my $self = shift; my $msg = _; eval {$self=$self-name} if ref($self); my $timestamp = ...; my

RE: Tree Transformations (was: Perl6 Macros)

2002-03-31 Thread David Whipp
Luke Palmer [mailto:[EMAIL PROTECTED]] wrote: Then the macro would not recieve 4 as the second argument, rather 2*6/3 in syntax tree form. Would the macro have to do its own constant folding? I hope not. So how could it check whether this thing was an integer? How could it differentiate

RE: rethinking printf

2002-03-06 Thread David Whipp
printf %d hash is $(%foo.string), $bar ; no ambiguity and no confusion. This would be nice, if scalar things use '$'. But: perl5: printf %d is $foo{bar}, $baz; perl6: printf %d is $(%foo{bar}), $baz; Not so nice. Dave.

RE: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread David Whipp
In a related matter, computer languages with Symbolic Mathematics capabilities, like Mapple, let you explicitly demand where do you want the operation to take place. This could be done naturally in perl6 using the colon meta-operator: my $plain = $c - $d : Math::Complex # 3.0 + 0i

RE: Apoc 4: The skip keyword

2002-01-30 Thread David Whipp
switch(...) { case 1: ...; nobreak; /* intentional fall-through */ case 2: ...; break; case 3: ...; } Does anyone agree that `nobreak' reads much better than `skip'? skip was uncomfortable when I read it (I

RE: Some Apocalypse 4 exception handling questions.

2002-01-23 Thread David Whipp
Peter Haworth [mailto:[EMAIL PROTECTED]] wrote: This is all very sensible, and I completely agree with it. However, don't we need some restrictions on what can go in PRE and POST blocks to ensure that they are still valid in inherited methods? There's another issue: sometimes we don't

RE: [dha@panix.com: Re: ^=~]

2002-01-22 Thread David Whipp
Piers Cawley [mailto:[EMAIL PROTECTED]] wrote: Damian Conway [EMAIL PROTECTED] writes: I suppose this discussion also raises the vexed question whether ??:: can also be put out to pasture in favour of: $val = if $x { 1 } else { 2 }; I like that idea. Only if you can also do:

RE: catching warnings

2002-01-21 Thread David Whipp
In light of Apo4, I thought I'd re-ask this question. Is the following still the approved idiom, or will we have a nice little /[A-Z]+/ thingie: sub foo { temp $SIG{__WARN__} = sub { warn $(timestamp) $@\n } warn hello } Dave. -- Dave Whipp, Senior Verification Engineer, Fast-Chip

RE: Apoc4: The loop keyword

2002-01-21 Thread David Whipp
Graham Barr wrote: But I have lost count of the number of times I have wanted to do if ((my $foo = bar()) eq 'foo') { ... } if ($foo eq 'bar') { ... } To be contrasted with: while (my($k, $v) = each %h1) { ... } while (my($k, $v) = each %h2) # error? { ... }

Apo4: PRE, POST

2002-01-18 Thread David Whipp
Apo4, when introducing POST, mentions that there is a corresponding PRE block for design-by-contract programmers. However, I see the POST block being used as a finalize; and thus allowing (encouraging?) it to have side effects. I can't help feeling that contract/assertion checking should not

catching warnings

2002-01-08 Thread David Whipp
Perl6 is going to introduce a non-resumable throw/catch mechanism to replace die/$@. (I assume that die will be synonymous with throw, for compatibility.) But what about warnings? I frequently find myself wanting to catch warnings (e.g. to add extra context around a library's use of undefined

RE: AOP

2001-10-24 Thread David Whipp
Aaron Sherman wrote: All of this is still coming into focus for me, and I want to spend more time reading the articles later, but for now I just wanted to see if anyone else has been thinking these thoughts I do like the idea of AOP; but I think the mechanism you suggest are too clumsy.

RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
More, someone has mentioned the %x{$_}++ feature, which IMHO, MUST continue to work. What is void plus one? Can't we utilize the lazy arrays stuff to make all this work. Out of the box, all entries could default to NaN. But its easy to write @a ^= 0; to change this default. I'm

Default values, was RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
Aaron Sherman wrote On Mon, Oct 22, 2001 at 11:30:01AM -0700, David Whipp wrote: More, someone has mentioned the %x{$_}++ feature, which IMHO, MUST continue to work. What is void plus one? Can't we utilize the lazy arrays stuff to make all this work. Out of the box, all

RE: Default values, was RE: the handiness of undef becoming NaN (when you want that)

2001-10-22 Thread David Whipp
Aaron Sherman wrote Larry's hubris notwithstanding, I'd like to suggest that more, in this case means no, it prints nothing. This *must* be true, as you don't want: @a ^+ @b to always return an infinite list. You want it to produce a list with (as a3 suggested) length

RE: Indenting

2001-10-16 Thread David Whipp
Well, as discussed briefly in an earlier thread, http:[EMAIL PROTECTED]/msg08514.html if we allow ! in function names, we can distinguish between the normal and in-place versions of functions without proliferating the number of keywords. chomp! $string; my $chomped_string =

RE: Indenting

2001-10-16 Thread David Whipp
Is chomp? just a bad example, or is there some utility in asking if a string has already been chomped? The query is asking what the string would look like, if it were chomped. Dave.

RE: NaN semantics

2001-10-10 Thread David Whipp
So the imaginary numbers would be standard literals? Like $x=2+10i; Great idea, as well as sqrt(-1) returning 1i istead of raising the exception. BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? -

RE: NaN semantics

2001-10-10 Thread David Whipp
First this thread tells me that 123foo will be 123 in numeric context. Now I find myself wondering what 123indigo evaluates to! It would evaluate to 123. If use complex is in effect, it would evaluate to 123i. At least that's the position I'm taking at the moment ;-) 123i

RE: NaN semantics

2001-10-09 Thread David Whipp
Damian Conway wrote: but I still have immense difficulty with the notion that: $x == NaN doesn't return true if $x contains NaN. Anyone with a hardware background should have no difficulty with this concept. All common HDLs have multi-valued logic systems, including values like

RE: Math functions? (Particularly transcendental ones)

2001-09-10 Thread David Whipp
Uri Guttman we are planning automatic over/underflow to bigfloat. so there is no need for traps. they could be provided at the time of the conversion to big*. OK. But will Perl support signaling and non-signaling NANs?

RE: Anyone actually experienced with object inheritance?

2001-07-02 Thread David Whipp
Michael G Schwern wrote: Rather than stumbling around in the dark here, is anyone actually experienced with object inheritance? Any Self programmers out there? Someone that's actually used this technique often and understands what works and what does? Any books/articles to recommend? Its

RE: Multiple classifications of an object

2001-06-27 Thread David Whipp
David L. Nicol wrote: The other standard solution is to add a Person has-a Employment_Status relationship, but that doesn't feel much better. It feels fine to me. Person has-a gender, person has-a job, it's more politically correct, even, than pigeonholing. You can even do dynamic

RE: Multiple classifications of an object

2001-06-27 Thread David Whipp
Mark J. Reed wrote: Okay, but now we're getting into the fundamental O-O model for Perl. I guess that's fair game? You can certainly make the case that prototype-based inheritance makes at least as much sense as class-based inheritance for a dynamic language like Perl. But that's a major

Multiple classifications of an object

2001-06-25 Thread David Whipp
When you blass an object in Perl, you give it exactly one type. The @ISA variable allows that type to refer to many other classes as the inheritance tree. @ISA is a list, but ref($obj) isn't. This means that you sometimes have to create a lot of useless classes to work around this limitation. A

RE: Multiple classifications of an object

2001-06-25 Thread David Whipp
Peter Scott wrote: What's wrong with multiple inheritance? You have to create a whole load of extra classes whose only purpose is to define a list of superclasses. Compare: bless $self, qw(Employed Male); with package Employed_Male; @ISA=qw(Employed Male); # multiple inheritance ...

RE: suggested properties of operator results

2001-06-11 Thread David Whipp
From: Damian Conway [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 4:06 PM To: [EMAIL PROTECTED] Subject: Re: suggested properties of operator results I think we will see n-ary comparisons allowed in Perl 6: if ($x $y $z $foo) {... but as special case syntactic sugar

RE: Properties and stricture

2001-06-05 Thread David Whipp
Michael G Schwern [mailto:[EMAIL PROTECTED]] wrote: Of course, there's problems of order of definition. What happens if Bar.pm is loaded before Foo? Dunno. simple sematics can be defined. If we see a declaration: package Foo is encapulated; then we throw an error if the namespace, Foo,

RE: what I meant about hungarian notation

2001-05-14 Thread David Whipp
Edward Peschko wrote: As to what the combined $bar[$foo] would mean: that depends on what $bar contains. I like visual clues to tell me what type of variable something is. And I disagree strongly with trying to steamroller the language's design paper-flat as much as I

RE: apo 2

2001-05-04 Thread David Whipp
is = typing, inheritance, etc. has = composition, aggregation, etc. True, but those are basic OO concepts, which don't neatly apply to property-lists (a very old Lisp concept that Perl6 is adopting). is does seem to imply an OO is-a relationship. So lets run with it! If $foo is an

RE: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread David Whipp
Dan Sugalski wrote At 12:19 PM 4/16/2001 -0700, Peter Scott wrote: Or were you espousing the notion that perl 6 programs should be able to contain sections of perl 5 code? That gives me strange palpitations. This is what I've been arguing against. Unless I misunderstand (and it

RE: Larry's Apocalypse 1

2001-04-09 Thread David Whipp
John Porter wrote I'm sure you don't want to write "$a = new Integer '32'". Of course. That would be unbearably absurd. But how often do you have to write expressions that operate on three or more URLs? Or even two? How many perl instrinsics return URLs? How many perl intrinsics

RE: Larry's Apocalypse 1

2001-04-06 Thread David Whipp
James Mastros wrote: print $::OUT http://www.wall.org/~larry/index.html; Please, no! A URL isn't a /new/ type of literal, really. Either it's a wierd form of a literal list, or it's a wierd type of file name, so you should open() it. Or it's a self-quoting literal, like

RE: Larry's Apocalypse 1

2001-04-06 Thread David Whipp
John Porter wrote: $mySite = http://www.foo.bar/text.html; Vs. $mySite = new URL 'http://www.foo.bar/text.html'; I am far from convinced. Simon Coxens wrote A language that doesn't have everything is actually easier to program in than some that do. -- Dennis M. Ritchie

RE: Larry's Apocalypse 1

2001-04-05 Thread David Whipp
One-liners run on a Perl 6 binary should just be Perl 6 code. Do we really have to worry about backwards compatibility with one liners? Hmm... programs that have perl one-liners inside them might be troublesome. Why not: perl -e 'perl 5 one-liner' perl --cmd 'perl 6 one-liner' i.e.

RE: What can we optimize (was Re: Schwartzian transforms)

2001-03-29 Thread David Whipp
From: Dan Sugalski [mailto:[EMAIL PROTECTED]] I'm hoping to have this stage of optimization in perl. Off by default with a normal parse-and-go run (though certainly enableable if you want), on by default with the bytecode compiler. Don't forget about run-time information: You could

RE: Schwartzian transforms

2001-03-28 Thread David Whipp
From: Russ Allbery [mailto:[EMAIL PROTECTED]] we can just flat-out say "We may optimize your sort function" I am strongly in favor of that approach. I see no reason to allow for weird side effects in Perl 6. Let me second the motion. "Allow optimisation" should be the default. A

RE: A Warning on Meaningless Additions (Was: Re: A funny thing about e)

2001-03-16 Thread David Whipp
perl -le '$n=1; print "$n \t",((1 + (1/$n))** $n) while $n*=1.001' [...] When to throw away a result as meaningless is certainly an important piece of wisdom, I do not know any programming languages that do it for you -- issue a warning when you've overloaded your accuracy instead