Re: PDD 4: Internal data types

2001-03-09 Thread David Mitchell
As I see it, there will be 3 types of access to bigint/nums. 1) there is the internal implementation of the PMC types associated with them. This is where all the messy code gets hidden (assembler optimations, register length-specific code etc). 2) PDD 2 requires that all PMC types return their

Re: PDD 4: Internal data types

2001-03-08 Thread David Mitchell
The C structure that represents a bigint is: struct bigint { void *num_buffer; UV length; IV exponent; UV flags; } [snip] The Cnum_buffer pointer points to the buffer holding the actual number, Clength is the length of the buffer, Cexponent is the base 10

lazy || and vtables

2001-02-21 Thread David Mitchell
Following up from a thread a couple of weeks ago, Dan wrote: Dave wrote: Hmmm, I can't quite how that trick works. How whould the following get evaluated: $opened || open(F, ...) The second PMC would point to a lazy list, so it wouldn't be evaluated unless its value gets fetched. Do

newPMC() (was: Re: PDD 2, vtables)

2001-02-21 Thread David Mitchell
Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) I think we shouldn't rule out the possibility of having multiple newPMC() style functions for grabbing PMCs used for different activities (eg lexicals vs tmps vs

Re: PDD for code comments ????

2001-02-21 Thread David Mitchell
Based on the silence == assent prinicple, I think we have agreed: 1. we need "a relatively strict and standard way" to document code. 2. This is the time and place to discuss it. 3. The result of the discusssion should be a PDD. 4. Most commentary should appear within the src file itself, or

Re: PDD for code comments ????

2001-02-20 Thread David Mitchell
Regarding comments in code: Chopping and misquoting wildly Jarkko Hietaniemi said: * I would define a relatively strict and standard way to do this so that the documentation can be extracted out. * lets avoid a markup-up flamewar Simon Cozens said: * I'd like to see Perl 6 written as a

Tolkein (was Re: PDD for code comments ????)

2001-02-20 Thread David Mitchell
Tolkien quotes are mandatory? perl5's globals.c malloc.c perlio.c perly.c universal.c xsutils.c definitely fail then. Sounds like some urgent patches need submitting to p5p ;-)

Re: Tolkein (was Re: PDD for code comments ????)

2001-02-20 Thread David Mitchell
Do we want to go with Tolkein quotes for perl 6 and, if so, who wants to put together a list of good ones? It's been ages since I've read the books, and I'm likely to pull quotes from other places anyway. (Usagi Yojimbo strikes me as a good place to yank from, as does Zot!, but Pratchett

Re: Tolkein (was Re: PDD for code comments ????)

2001-02-20 Thread David Mitchell
And what about us poor semi-literates who've never heard of Yojimbo ??? If we can't go with Tolkien, I'd vote for Pratchett, 'cause *everyone*'s read him :-) Adams rather than Pratchett, I'd think. :) But Pratchet has 20+ books to his credit, so we need never run out of quotes :-)

PDD for code comments ????

2001-02-19 Thread David Mitchell
I originally starting writing this as a bit of a joke, then I thought perhaps I should submit it as a serious suggestion. Anyone violently against or in favour? Is this even an issue that should go in a PDD? Does anyone care? Should I return to my box now? Dave M.

Re: PDD 2: sample add()

2001-02-16 Thread David Mitchell
Ken Fox [EMAIL PROTECTED] wrote: David Mitchell wrote: To get my head round PDD 2, I've just written the the outline for the body of the add() method for a hypophetical integer PMC class: [... lots of complex code ...] I think this example is a good reason to consider only having one

Re: PDD 2, vtables

2001-02-14 Thread David Mitchell
After a week's delay where I've just been too busy, I thought I'd resurrect the corpse of a thread I was involved in. First off, on Wed, 07 Feb 2001 14:37:33, Dan Sugalski [EMAIL PROTECTED] wrote: At 07:05 PM 2/7/2001 +, David Mitchell wrote: Dan, before I followup your reply to my

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Some comments about the vtable PDD... First a general comment. I think we really need to make it clear for each method, which arg respresents the object that is having its method called (ie which is $self/this so to speak). One way to make this clear would be to insist that the first arg is

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Please see my previous post on the subject. As I pointed there, implementing || and like that breaks short-circuits. No, it doesn't. Just because you pass in two PMCs doesn't mean that they both need to be evaluated. Though the PDD does need to be clearer about how that happens. Hmmm,

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Nicholas Clark [EMAIL PROTECTED] mused: On Wed, Feb 07, 2001 at 04:03:49PM +, David Mitchell wrote: BTW, should the vtable include all the mutator operators too, ie ++, += and so on, on the grounds that an implementation may be able do this more efficiently internally

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
++ and -- are already slightly messy in perl5 pp_preinc, pp_postinc, pp_predec and pp_postdec live in with all the ops. They know how to increment and decrement integers that don't overflow, and call routines in sv.c to increment and decrement anything else. Actually, this

Re: Another approach to vtables

2001-02-07 Thread David Mitchell
Dan, I think there is a real problem with your vtable approach. [ etc etc ] I think there's an important misconception about tieing and overloading going on hre which I will attempt to clear up. (Then Dan and co can point out that I;'m I;m wrong and have just made matters worsse ;-) First

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
I'm not either. They feel like they should be operators. But I don't like the thought of going in and out of a lot of generic routines for $a = 3; $a += 2; when the integer scalar ought to know what the inside of another integer scalar looks like, and that 2 + 3 doesn't overflow.

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Dan, before I followup your reply to my list of nits about the PDD, can I clarify one thing: destruction. I am assuming that many PMCs will require destruction, eg calling destroy() on a string PMC will cause the memory used by the string data to be freed or whatever. Only very simple PMCs (such

Re: Another approach to vtables

2001-02-06 Thread David Mitchell
2. Perl 5 doesn't separate well a `variable' from a `value', and this should be done to achieve a more clear design. Perl5 does in fact make a clear separation. 'values' are SV structures (and AVs and HVs etc). Variables are names in stashes, PADs etc that have a pointer to an SV or whatever.

Re: standard representations

2001-01-02 Thread David Mitchell
Nick Ing-Simmons [EMAIL PROTECTED] wrote BigFloat could well build on BigInt for its "mantissa" and have another int-of-some-kind as its exponent. We don't need to pack it tightly so we should probably avoid IEEE-like hidden MSB. The size of exponent is one area where "known range of int" is

use some flag bits for payload?

2000-12-29 Thread David Mitchell
The current thread about bigints and overflows and stuff has given me a thought: A few of the bits in the flags word of an SV should be reserved as part of the payload (as opposed to being generic SV flags), so a particular SV type can make whatever internal use it likes of them. Ie the payload

Re: standard representations

2000-12-28 Thread David Mitchell
Daniel Chetlin [EMAIL PROTECTED] wrote: What is it about automatic conversion to bigints (done well) that scares you? Well, consider the following perl5 code: sub factorial { my $n = shift; my ($f,$i) = (1,0); $f *= ++$i while $i $n; $f; } Someone might be

mixed numeric and string SVs.

2000-12-20 Thread David Mitchell
Has anyone given thought to how an SV can contain both a numeric value and string value in Perl6? Given the arbitrary number of numeric and string types that the vatble scheme of Perl6 support it will be unviable to to have special types for all permuations (eg, utf8_nv, unicode32_iv,

Re: mixed numeric and string SVs.

2000-12-20 Thread David Mitchell
It seems to me the following options are poossible: 1. We no longer save conversions, so $i="3"; $j+=$i for (...); does an aton() or similar each time round the loop I fear this would be a performance hit. I'm told TCL pre version 8 was like this - everything's a string and

Re: String representation

2000-12-18 Thread David Mitchell
Simon Cozens [EMAIL PROTECTED] IMHO, the first thing we need to design and code is the API and runtime library, since everything else builds on top of that, and we can design other stuff in parallel with coding it. (A lot of it will be grunt work.) Personally I feel that that string part of

Re: Opcodes (was Re: The external interface for the parser piece)

2000-12-18 Thread David Mitchell
Dan Sugalski [EMAIL PROTECTED] wrote: At 06:05 PM 12/12/00 +, David Mitchell wrote: Also, some of the standard perumations would also need to do some re-invoking, eg ($int - $num) would invoke Int-sub[NUM](sv1,sv2,0), which itself would just fall through to Num-sub[INT](sv2,sv1,1

Re: String representation

2000-12-18 Thread David Mitchell
Nick Ing-Simmons [EMAIL PROTECTED] wrote: What are string functions in your view? m// s/// join() substr index lc, lcfirst, ... | ~ ++ vec '.' '.=' It rapidly gets out of hand. Perhaps, but consider that somewhere within the perl internals there have to be

Re: Opcodes (was Re: The external interface for the parser piece)

2000-12-13 Thread David Mitchell
Nick Ing-Simmons [EMAIL PROTECTED] wrote: That is a Language and not an internals issue - Larry will tell us. But I suspect the answer is that it should "work" without any special stuff for simple perl5-ish types - because you need to be able to translate 98% of 98% of perl5 programs.

Re: Opcodes (was Re: The external interface for the parser piece)

2000-12-12 Thread David Mitchell
On Thu, 07 Dec 2000, Dan Sugalski [EMAIL PROTECTED] mused: My original suggestion was that scalar types provide a method that says how 'big' it is (so complex bigreal real int etc), and pp_add(), pp_sub() etc use these values to call the method associated with the biggest operand,

Re: Opcodes (was Re: The external interface for the parser piece)

2000-12-12 Thread David Mitchell
Nicholas Clark [EMAIL PROTECTED] wrote: On Tue, Dec 12, 2000 at 02:20:44PM +, David Mitchell wrote: If we assume that ints and nums are perl builtins, and that some people have implemented the following external types: byte (eg as implemented as a specialised array type), bigreal

RE: Meta-design

2000-12-07 Thread David Mitchell
(whoops, correcting my own post!): sva-refcount=0; sva-refcount++; // these first 2 combined if we get the implemention right svb-refcount=0; svb-refcount++; // ditto sva-refcount++; ... if (--sva-refcount == 0) ... // branch not taken if (--svb-refcount == 0) ... // branch taken, if

Re: Opcodes (was Re: The external interface for the parser piece)

2000-12-07 Thread David Mitchell
Nicholas Clark [EMAIL PROTECTED] wrote: On Thu, Dec 07, 2000 at 01:14:40PM +, David Mitchell wrote: Dan Sugalski [EMAIL PROTECTED] wrote: All the math is easy if the scalars are of known types. Addition and multiplication are easy if only one of the scalars involved is of known

Re: SvPV*

2000-11-28 Thread David Mitchell
Nick Ing-Simmons [EMAIL PROTECTED] wrote: Dave Storrs [EMAIL PROTECTED] writes: On Tue, 21 Nov 2000, Jarkko Hietaniemi wrote: Yet another bummer of the current SVs is that they poorly fit into 'foreign memory' situations where the buffer is managed by something else than Perl. "No,

Re: SvPV*

2000-11-23 Thread David Mitchell
It could be argued that the way to implement "enhanced" strings, eg strings with embedded attributes (html, rtf,) is for someone to write a specific SV class to deal with that kind of string. As has been pointed out, a difficulty with this is that standard regexes must be able to operate on

Re: SvPV*

2000-11-22 Thread David Mitchell
Nicholas Clark [EMAIL PROTECTED] writes: How does the regexp replacement engine cope with this? By implementing all replacements as substr() type ops? [or behaving as if it implements... whilst cheating and doing it direct for scalars it understands?] Or don't we need to work this out at

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: 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

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 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 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 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

RFC35 (base format for perl variables) - some comments

2000-09-25 Thread David Mitchell
Here are a few comments on RFC35 (base format for perl variables). [ NB - I've only just joined this list, and although I've rummaged through the archives, I may have missed bits which make my comments obsolete/absurd etc... :-) ] 1. void *variable_data; I would suggest having a slightly