Re: Special syntax for numeric constants [Was: A tentative list of vtable functions]

2000-10-25 Thread Ken Fox
David Mitchell wrote: Well, I was assuming that there would be *a* numeric class in scope - as defined be the innermost lexical 'use foo'. And that numeric class would remove int and num from the scope? I assumed that Perl wouldn't be clever enough to know about all available numberic types

Re: Special syntax for numeric constants [Was: A tentative list of vtable functions]

2000-10-24 Thread David Mitchell
Ken Fox [EMAIL PROTECTED] wrote: David Mitchell wrote: Now of course if we have the luxury of deciding that core perl 'knows' about complex numbers, then of the parser can be made to recognise ... The core doesn't need to know -- that was my point. All the core needs is the basic

Re: Special syntax for numeric constants [Was: A tentative list of vtable functions]

2000-10-24 Thread Dan Sugalski
At 02:34 PM 10/24/00 +0100, David Mitchell wrote: Ken Fox [EMAIL PROTECTED] wrote: David Mitchell wrote: Now of course if we have the luxury of deciding that core perl 'knows' about complex numbers, then of the parser can be made to recognise ... The core doesn't need to know -- that

Re: A tentative list of vtable functions

2000-10-18 Thread David Mitchell
Ken Fox [EMAIL PROTECTED] wrote: use complex; my $c = 2__3; # 2 + 3i That's really gross. 2 + 3i is just add(integer(2), complex(0,3)) with compile-time constant folding eliminating the add(). I would even go so far as to say that 3i is just syntactic sugar for

Special syntax for numeric constants [Was: A tentative list of vtable functions]

2000-10-18 Thread Ken Fox
David Mitchell wrote: Now of course if we have the luxury of deciding that core perl 'knows' about complex numbers, then of the parser can be made to recognise ... The core doesn't need to know -- that was my point. All the core needs is the basic constant folding rules _it_already_has_

Re: A tentative list of vtable functions

2000-10-17 Thread Ken Fox
"ye, wei" wrote: One C++ problem I just found out is memory management. It seems that it's impossible to 'new' an object from an specified memory block. So it's impossible to put free'd objects in memory pool and re-allocate them next time. Stuff like that isn't the problem with using C++.

Re: A tentative list of vtable functions

2000-10-17 Thread Dan Sugalski
At 01:34 PM 10/17/00 -0400, Ken Fox wrote: I think the general idea is that the advantages of C++ don't move us far enough out of our comfortable local minimum to make it worthwhile. Yup, that pretty much covers it. C++ also has an awful lot of stuff in it that, while interesting, is too likely

Re: A tentative list of vtable functions

2000-10-02 Thread David Mitchell
Further to my earlier ramblings and worries about binary operators and overloading etc Here is a proposal for the numerical part of the SV API that provides a framework for arbitrary precision arithmetic, while still allowing standard ints and floats to be handled efficiently. Some of the

Re: A tentative list of vtable functions

2000-10-02 Thread Jarkko Hietaniemi
Here is a proposal for the numerical part of the SV API that provides a framework for arbitrary precision arithmetic, while still allowing standard ints and floats to be handled efficiently. [some quick very high-level comments] Don't forget bigrats. 1) binary operators should in general

Re: A tentative list of vtable functions

2000-10-02 Thread David Mitchell
Jarkko Hietaniemi [EMAIL PROTECTED] wrote: [some quick very high-level comments] Don't forget bigrats. I'm not too familiar with the concept of rational numbers in a computing complex. What's your definition of a (big)rat? Fixed point?? 2) in general we want the result of a binop to be

Re: A tentative list of vtable functions

2000-10-02 Thread Jarkko Hietaniemi
On Mon, Oct 02, 2000 at 12:47:18PM +0100, David Mitchell wrote: Jarkko Hietaniemi [EMAIL PROTECTED] wrote: [some quick very high-level comments] Don't forget bigrats. I'm not too familiar with the concept of rational numbers in a computing complex. What's your definition of a

Re: A tentative list of vtable functions

2000-10-02 Thread David Mitchell
Don't forget bigrats. I'm not too familiar with the concept of rational numbers in a computing complex. What's your definition of a (big)rat? Fixed point?? bigint1 / bigint2. Possibly represented as a triad of bigints, bigint1 + bigint2 / bigint3. I'm tempted to suggest that

Re: A tentative list of vtable functions

2000-10-02 Thread David Mitchell
For the record: I hate the current policy of defaulting to NVs for arithmetic ops. If I say '2' I do mean an IV of 2, not an NV of 2.000. Currently if I say $a = 2; $b = 3; $c = $a + $3; the $c will be an NV of of 5.000, or thereabouts, een while $a and

Re: A tentative list of vtable functions

2000-10-02 Thread Jarkko Hietaniemi
Assuming that the perl parser generated IV SVs rather than NVs for the 2 constants 2,3, then my scheme would handle this fine; the IV It currently does so. version of add() would be called, and an IV SB would result. "The IV version of add()"? Beware of combinatorial explosion: addII,

Re: A tentative list of vtable functions

2000-10-02 Thread Jarkko Hietaniemi
would need to know a fair bit about particular user-defined types that have been loaded in, on order to make clever interpretations of literals. Precisely. Assume I want $a = 2 + 3i; to work... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we

Re: A tentative list of vtable functions

2000-10-02 Thread David Mitchell
would need to know a fair bit about particular user-defined types that have been loaded in, on order to make clever interpretations of literals. Precisely. Assume I want $a = 2 + 3i; to work... Which I what I suggest we abandon attempts to make the parser do intellignet

Re: A tentative list of vtable functions

2000-09-29 Thread ye, wei
Dan Sugalski wrote: At 02:29 PM 9/29/00 +0100, David Mitchell wrote: Regarding the tentative list of vtable functions: I'm rather worried about binary operators, eg 'is_equal', 'add' etc. The danger with these is that they may impose a single implementation of scalars upon us

Re: A tentative list of vtable functions

2000-09-14 Thread Nick Ing-Simmons
Nathan Torkington [EMAIL PROTECTED] writes: Dan Sugalski writes: It's possible, for example, for a tied/overloaded/really-darned-strange variable to look true but still be false. If you do: $foo = $bar || $baz; and both $bar and $baz are objects, the 'naive' way is to make $foo be

Re: A tentative list of vtable functions

2000-09-13 Thread Ken Fox
Nick Ing-Simmons wrote: Ken Fox [EMAIL PROTECTED] writes: Dan Sugalski wrote: For something like: @foo = @bar || @baz; I have no problem with the call sequence looking like (pseudo-codish here): set_context(ARRAY, ASSIGN); foo-store(bar-log_or(bar, baz)); But

Re: A tentative list of vtable functions

2000-09-13 Thread Nathan Torkington
Dan Sugalski writes: It's possible, for example, for a tied/overloaded/really-darned-strange variable to look true but still be false. If you do: $foo = $bar || $baz; and both $bar and $baz are objects, the 'naive' way is to make $foo be $bar. But it's distinctly possible that $bar

Re: A tentative list of vtable functions

2000-09-13 Thread Dan Sugalski
At 03:56 PM 9/13/00 -0400, Ken Fox wrote: Nick Ing-Simmons wrote: Ken Fox [EMAIL PROTECTED] writes: Dan Sugalski wrote: For something like: @foo = @bar || @baz; I have no problem with the call sequence looking like (pseudo-codish here): set_context(ARRAY,

Re: A tentative list of vtable functions

2000-09-10 Thread Dan Sugalski
At 07:58 PM 9/9/00 +, Nick Ing-Simmons wrote: Ken Fox [EMAIL PROTECTED] writes: Short circuiting should not be customizable by each type for example. We are already having that argument^Wdiscussion elsewhere ;-) But I agree variable vtables are not the place for that. As do I, up to a

Re: A tentative list of vtable functions

2000-09-09 Thread Nick Ing-Simmons
Ken Fox [EMAIL PROTECTED] writes: Short circuiting should not be customizable by each type for example. We are already having that argument^Wdiscussion elsewhere ;-) But I agree variable vtables are not the place for that. -- Nick Ing-Simmons

Re: A tentative list of vtable functions

2000-09-01 Thread Dan Sugalski
At 10:46 PM 8/31/00 +, David L. Nicol wrote: Dan Sugalski wrote: Okay, here's a list of functions I think should go into variable vtables. All the math functions are in here. Can the entries that my type does not use be replaced with other functions that my type does use? That's what

Re: A tentative list of vtable functions

2000-09-01 Thread Chaim Frenkel
"DS" == Dan Sugalski [EMAIL PROTECTED] writes: DS Okay, here's a list of functions I think should go into variable vtables. DS Functions marked with a * will take an optional type offset so we can DS handle asking for various permutations of the basic type. DS type DS name What are

Re: A tentative list of vtable functions

2000-09-01 Thread Grant M.
DS get_bool Is this allowed to return a non-true/false result? Or is everything true or false? Dunno yet. I'm thinking just a true/false value, but... A tri-state bool would be really cool (i.e, true/false/undef). Although I understand that this probably isn't where Perl 6 is going, most

Re: A tentative list of vtable functions

2000-09-01 Thread David L. Nicol
Dan Sugalski wrote: We're shooting for speed here. Any common operation that could be affected by the type of the variable should be represented so a custom function can be called that does exactly what needs to be done. Dan so if I want to make up

Re: A tentative list of vtable functions

2000-09-01 Thread Larry Wall
Dan Sugalski writes: : Type returns a magic cookie value of some sort (Not sure what sort yet), : name returns a string with the name of the type of the variable. Why can't the type object just stringify to the name of the type? From a language level, I'm inclined to say that any bare

Re: A tentative list of vtable functions

2000-09-01 Thread Nick Ing-Simmons
Dan Sugalski [EMAIL PROTECTED] writes: is_equal (true if this thing is equal to the parameter thing) is_same (True if this thing is the same thing as the parameter thing) is_equal in what sense? (String, Number, ...) and how is is_same different from just comparing addresses of the

Re: A tentative list of vtable functions

2000-09-01 Thread Chaim Frenkel
"NI" == Nick Ing-Simmons [EMAIL PROTECTED] writes: NI Dan Sugalski [EMAIL PROTECTED] writes: is_equal (true if this thing is equal to the parameter thing) is_same (True if this thing is the same thing as the parameter thing) NI is_equal in what sense? (String, Number, ...) NI and how is

Re: A tentative list of vtable functions

2000-09-01 Thread Dan Sugalski
At 06:07 PM 9/1/00 +, Nick Ing-Simmons wrote: Dan Sugalski [EMAIL PROTECTED] writes: is_equal (true if this thing is equal to the parameter thing) is_same (True if this thing is the same thing as the parameter thing) is_equal in what sense? (String, Number, ...) I was thinking if

Re: A tentative list of vtable functions

2000-09-01 Thread Dan Sugalski
At 10:23 AM 9/1/00 -0700, Larry Wall wrote: Dan Sugalski writes: : Type returns a magic cookie value of some sort (Not sure what sort yet), : name returns a string with the name of the type of the variable. Why can't the type object just stringify to the name of the type? I'd figured that the

Re: A tentative list of vtable functions

2000-09-01 Thread Dan Sugalski
At 11:49 AM 9/1/00 -0500, David L. Nicol wrote: Dan Sugalski wrote: We're shooting for speed here. Any common operation that could be affected by the type of the variable should be represented so a custom function can be called that does exactly what needs to be done.

Re: A tentative list of vtable functions

2000-09-01 Thread Bryan C . Warnock
On Fri, 01 Sep 2000, Dan Sugalski wrote: I'm not sure. They're there mainly for guaranteed unfiltered access to the variable's guts, and I'm not sure what things will need that. I use direct, raw access in prototyping when dipping back into C for "heavy" data manipulations - bit stream

Re: A tentative list of vtable functions

2000-08-31 Thread Buddha Buck
At 04:43 PM 8/31/00 -0400, Dan Sugalski wrote: Okay, here's a list of functions I think should go into variable vtables. Functions marked with a * will take an optional type offset so we can handle asking for various permutations of the basic type. Perhaps I'm missing something... Is this for

Re: A tentative list of vtable functions

2000-08-31 Thread Tom Christiansen
get_int * get_float * Could you elaborate on these a lot? What's an 'int'? What's a 'float'? Having lately been battling a lot with quad ints and doubles vs long doubles I seriously want this interface not to suck. I was a tad concerned there, too. I'm hoping one can painlessly

Re: A tentative list of vtable functions

2000-08-31 Thread Ken Fox
Dan Sugalski wrote: get_value set_value Wouldn't these go on the SV and not on the inner type? Maybe I'm thinking value when you're saying variable? The following seem useful on variables too: before_get_value after_get_value before_set_value after_set_value There ought to be

Re: A tentative list of vtable functions

2000-08-31 Thread Jarkko Hietaniemi
Wouldn't these go on the SV and not on the inner type? Maybe I'm thinking value when you're saying variable? The following seem useful on variables too: before_get_value after_get_value before_set_value after_set_value There ought to be specializations of get_value and

Re: A tentative list of vtable functions

2000-08-31 Thread Nathan Torkington
Jarkko Hietaniemi writes: I'm not too worried about getting the vtbl right at the first because it will be pretty obvious how it should go once the code starts to form. Some planning isn't that painful :-) Yes. Especially given that vtables are an unbenchmarked change. It'd be good to

Re: A tentative list of vtable functions

2000-08-31 Thread Dan Sugalski
At 04:59 PM 8/31/00 -0400, Buddha Buck wrote: At 04:43 PM 8/31/00 -0400, Dan Sugalski wrote: Okay, here's a list of functions I think should go into variable vtables. Functions marked with a * will take an optional type offset so we can handle asking for various permutations of the basic type.

Re: A tentative list of vtable functions

2000-08-31 Thread Dan Sugalski
At 03:12 PM 8/31/00 -0600, Tom Christiansen wrote: get_int * get_float * Could you elaborate on these a lot? What's an 'int'? What's a 'float'? Having lately been battling a lot with quad ints and doubles vs long doubles I seriously want this interface not to suck. I was a

Re: A tentative list of vtable functions

2000-08-31 Thread Dan Sugalski
At 05:30 PM 8/31/00 -0400, Ken Fox wrote: Dan Sugalski wrote: get_value set_value Wouldn't these go on the SV and not on the inner type? Maybe I'm thinking value when you're saying variable? Nope. The get/set value functions are for when something knows what the SV (or whatever we

Re: A tentative list of vtable functions

2000-08-31 Thread Dan Sugalski
At 03:45 PM 8/31/00 -0600, Nathan Torkington wrote: Jarkko Hietaniemi writes: I'm not too worried about getting the vtbl right at the first because it will be pretty obvious how it should go once the code starts to form. Some planning isn't that painful :-) Yes. Especially given that

Re: A tentative list of vtable functions

2000-08-31 Thread David L. Nicol
Dan Sugalski wrote: Okay, here's a list of functions I think should go into variable vtables. All the math functions are in here. Can the entries that my type does not use be replaced with other functions that my type does use? Functions marked with a * will take an optional type offset

Re: A tentative list of vtable functions

2000-08-31 Thread Jarkko Hietaniemi
How about to_string * from_string * as generalizations of formatted/pretty input/output and freeze/thaw (cf printf/Data::Dumper/Storable)? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen

Re: A tentative list of vtable functions

2000-08-31 Thread Bradley M. Kuhn
Dan Sugalski wrote: get_value set_value The get/set value functions are for when something knows what the SV (or whatever we call it) really is and can handle the raw data. For example, if my code knew a SV held a complex number (which doesn't map well to the int/float/char