Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Proposed steps towards the next release 0.2 and beyond.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leopold Toetsch  
View profile  
 More options Mar 7 2005, 5:01 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Mon, 07 Mar 2005 11:01:13 +0100
Local: Mon, Mar 7 2005 5:01 am
Subject: Proposed steps towards the next release 0.2 and beyond.

Below inline/attached is a proposal for Parrot core changes. I'll post a
more detailed proposal for 1) objects in a minute.

leo

[ REL-0.2.txt 4K ]
Proposed steps towards the next release 0.2 and beyond.

These are numbered just for reference but are else in no particular
order. A lot can be done in parallel. A lot needs more refinement and
discussion. And *some* should be approved by Dan.

Not all will be finished for 0.2 but I hope a lot.

As this is a pretty long list I'll start distinct threads with more
details and a rationale. Follow up's should go there.

1) objects

1.1) split C<dispatch> from C<find_method>
   - find_method ... check if the class can do the method
   - dispatch    ... do the full method lookup, possibly MMD

1.2) new C<mro> array
   - array of classes in canonical method resolution order

2) vtables

2.1) all implemented vtable and MMD slots in one class become
   NCI methods.

2.2) the vtable entries get split into "roles"

   struct _vtable {
     init, destroy, hash, mark, class,
     ...                         // common, main part
     Vtbl_scalar*as_scalar;      // abs, not, int, num, ...
     Vtbl_...   *as_native_scalar// get_integer, set_integer_native, ...
     Vtbl_array *as_array;       // get_pmc_keyed, push, pop, ...
     Vtbl_...   *as_native_array // get_integer_keyed, ...
     Vtbl_hash  *as_hash;        // exists_keyed, ...
     ...        *as_native_hash; // get_integer_keyed_str, ...
                *as_iterator;    // get_next, ...
                *as_object;      // get_attribute, ...
     ...
   };

3) function and method signatures

3.1) *the object is passed to methods as the first argument*

3.2) *change to calling conventions needed*

  multi sub foo(int $a, float $b) {...}
  multi sub foo(float $a, int $b) {...}

    set I5, x
    set N5, y
    invokecc "foo"     # now what?

3.3) *need per scope register frames* for timely destruction

4) more vtables

4.1) new vtable methods that return a new destination PMC

   add dest, l, r        # use existing dest PMC
   n_add dest, l, r      # create new dest PMC

4.1.1) implement a language pragma in assembler, e.g.:

  .HL_language Python

4.1.2) create table of canonical types per language mapping

  Integer - PyInt - TclInt - Perl6Int - ...

4.2) separate inplace operations from infix operations

   dest += r        <=>   dest."__i_add"(r)

4.3) misc new vtables:
  - coerce, hash, get_numeric, ...
  - new PMC variants of exisiting vtables

5) fix MMD and vtable operator inheritance

5.1) implement MMD dispatcher

5.2) Parrot infix operator equivalence:

"You are in a maze of twisty little passages, all alike.":

   add d, l, r
   d = add l, r
   d = l + r
   d = l."__add"(r)
   d = "__add"(l, r)

are all the same.

And probably:

  .use n_operators
  ...
  d = l + r      <=>      d = l."__n_add"(r)

5.3) use dynamic dispatch for prefix/postfix too

For PMC operands, these are all the same:

   abs d, a
   d = abs a
   d = a."__abs"()
   d = "__abs"(a)

6.) create list of builtins

All function-like PMC-related opcodes become methods in some namespace

6.1) create appropriate namespaces, e.g.

   sin x, y        <=>   x = Math."__sin"(y)     # PMC
   sin N0, N1      # native float variant remains
   getstdin Px     <=>   Px = IO."__getstdin"()
   sweep 1         <=>   GC."__sweep"(1)
   split a, d, s   <=>   a = String."__split"(d, s)  # if d isa String
                   <=>   a = d."__split"(s) # generally

The translation is done by the assembler according to the list of builtins
so that the current syntax remains valid.

7) *new PMC layout*

7.1) *PMCs become variable sized*

7.2) *the STRING* type becomes an alias for the String PMC*

7.3) *a Buffer becomes kind of a CharArray PMC* - if we still need a Buffer

8) simplify Hash PMC

8.1) get rid of movable Hash buffers

8.2) get rid of indirection through BucketIndex

9) redo iterators

9.1) iterator vtables

  - get_iter vtable (is ok)
  - iter_next vtable - replaces current next_xx_keyed/shift sequence

9.2) an iterable implements C<get_iter>
     an interator can C<iter_next>

9.3) fix slice, range, xrange, ... iterators

10) Last but not least

10.1) continue work on unicode, strings, building & installation, GC,
   libraries, threads, events, ...

10.2) new things like the Version PMC, async IO, and what not.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roger Browne  
View profile  
 More options Mar 7 2005, 7:09 am
Newsgroups: perl.perl6.internals
From: ro...@eiffel.demon.co.uk (Roger Browne)
Date: Mon, 07 Mar 2005 12:09:02 +0000
Local: Mon, Mar 7 2005 7:09 am
Subject: Re: Proposed steps towards the next release 0.2 and beyond.

On Mon, 2005-03-07 at 11:01 +0100, Leopold Toetsch wrote:
> 4.1.1) implement a language pragma in assembler, e.g.:

>   .HL_language Python

A pragma like that seems to split high-level languages into two groups:
those that are specially known to parrot, and those that are not. I'd
like it to be possible for ANY scripting language to be compiled to IMC
or PASM, and for that compiled code to be runnable directly (if it uses
only built-in PMC classes), or with the addition of dynamically-loaded
classes (if the built-in PMC classes are not suitable).

> 4.1.2) create table of canonical types per language mapping

>   Integer - PyInt - TclInt - Perl6Int - ...

Why not use a pragma to list the canonical types, instead of a
".HL_language" pragma.

In the language I'm implementing, there are distinct PMCs for Integer,
Character, Boolean, Bits and Enumeration - but I don't want lose
interoperability with other languages that use one integer type for all
of these.

Within my language, each of the above types is implemented with its own
PMC, but each of these PMCs uses the same internal layout as .Integer.
Therefore, it would be fine for them all to be treated at an integer
within inter-language calls. But there needs to be a way for my IMC to
tell parrot about this.

Here's an example of how it could be done for a language that uses one
PMC for all integer-like types:

   .Language_name "ruby"  # just a String; used for messages etc
   .Language_mapping Integer     <-> RubyInt
   .Language_mapping Character   <-> RubyInt
   .Language_mapping Boolean     <-> RubyInt
   .Language_mapping Bits        <-> RubyInt
   .Language_mapping Enumeration <-> RubyInt
   .Language_mapping String      <-> RubyString
   ...etc

and here's how it might look for a language that has a greater degree of
abstraction:

   .Language_name "Bird"
   .Language_mapping Integer     <-> BirdInteger
   .Language_mapping Character   <-> BirdCharacter
   .Language_mapping Boolean     <-> BirdBoolean
   .Language_mapping Bits        <-> BirdBits
   .Language_mapping Enumeration <-> BirdEnum
   .Language_mapping String      <-> BirdString
   ...etc

This would enable parrot to know that when a BirdBoolean is passed to a
ruby method, BirdBoolean has a Boolean interface which ruby can treat as
a RubyInt.

If the ruby method wants to return a character, perhaps parrot could
provide an "abstract" version of the "new" opcode, so that ruby can
create a "new abstract Character". Parrot would then consult the
canonical types, and would create a BirdCharacter if the calling
language was "Bird", but would create a PyInt if the calling language
was "Python".

I hope this makes some sense, and that you can see some merit in it.

> Proposed steps towards the next release 0.2 and beyond.

I'd be very pleased to see working support in 0.2 for
setfile/setline/setcolumn so that when my IMC code fails due to (e.g.) a
divide by zero error, the parrot runtime can report the source location
in my high-level code rather than the source location in my IMC.

Regards,
Roger
--
Roger Browne <ro...@eiffel.demon.co.uk>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to ".HL_language pragma (was: Proposed steps towards the next release 0.2 and beyond.)" by Leopold Toetsch
Leopold Toetsch  
View profile  
 More options Mar 7 2005, 7:50 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Mon, 7 Mar 2005 13:50:59 +0100
Local: Mon, Mar 7 2005 7:50 am
Subject: .HL_language pragma (was: Proposed steps towards the next release 0.2 and beyond.)

Roger Browne <ro...@eiffel.demon.co.uk> wrote:
> On Mon, 2005-03-07 at 11:01 +0100, Leopold Toetsch wrote:
>> 4.1.1) implement a language pragma in assembler, e.g.:

>>   .HL_language Python
> A pragma like that seems to split high-level languages into two groups:
> those that are specially known to parrot, and those that are not.

Not really. The rational for the .HL_language is twofold:
- all modules and therefore all subroutines in it should have the HLL
  name attached to it.
- the vtable and MMD methods that return new PMCs should return a PMC
  that is consistent with the types of that language. If no specific
  type is registered, Parrot's default or standard types like
  Integer, Float, or String are used.

> Why not use a pragma to list the canonical types, instead of a
> ".HL_language" pragma.

This is of course part of the plan :) The ".HL_language" or
".Language_name" pragma specifies the mapping to use for the rest of the
source file. And the mappings should be dynamically extendable as ...

>    .Language_mapping Integer     <-> RubyInt

.. it's shown here, yes.

> I'd be very pleased to see working support in 0.2 for
> setfile/setline/setcolumn so that when my IMC code fails due to (e.g.) a
> divide by zero error, the parrot runtime can report the source location
> in my high-level code rather than the source location in my IMC.

Yep. Good point. It was discussed some time ago and went off into the
multi-dimensionality of the code location ;)

But yes. Code is ever becoming more complex and debugging is already a
pain. The lexer already knows about setfile and setline as well as
C-like #line directives. The information is discarded but should go into
similar metadata like PIR-line information is already using.

> Regards,
> Roger

leo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MrJoltCola  
View profile  
 More options Mar 7 2005, 10:30 am
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (MrJoltCola)
Date: Mon, 07 Mar 2005 10:30:02 -0500
Local: Mon, Mar 7 2005 10:30 am
Subject: Re: .HL_language pragma (was: Proposed steps towards the next release 0.2 and beyond.)
At 07:50 AM 3/7/2005, Leopold Toetsch wrote:

>Roger Browne <ro...@eiffel.demon.co.uk> wrote:
> > On Mon, 2005-03-07 at 11:01 +0100, Leopold Toetsch wrote:

> >> 4.1.1) implement a language pragma in assembler, e.g.:

> >>   .HL_language Python

Sounds good to me except that I would prefer you remove the HL_
and just call it .language to be consistent with other directives.
Incidentally this is what .NET uses as well except its implementation
uses GUID instead of a string, and it also allows the compiler
vendor and source document type to be included in the directive.

Dan and I talked about this a couple of years ago on IRC.
Originally I wanted to stay away from GUIDs as I think they are overkill,
and had considered allowing ASCII:

.language Perl6
.language Perl6:ThePerlFoundation

But..., this requires this section in the bytecode to be variable sized,
so there might be some merit to using GUIDs, especially for vendors.

I think to keep PIR "convenient" for hackers I want to accept both
strings and 32 bit integers for each. If a string, it must be already
registered in IMCC and we can probably reserve the first 1024 for
"pre-registering" but IMCC still would be able to accept integers.

In any case, it needs to be fixed width in the bytecode header.

We need to revisit the bytecode format. Last time through, I put
an "Opcode type" at some offset, per Dan's request.
We store a magic number for that. I'm pretty sure we can use
this field to identify the language using whatever is provided in the
.language pragma, but I can't speak for Dan. I think he might
have had different plans for opcode type.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to ".HL_language pragma" by Leopold Toetsch
Leopold Toetsch  
View profile  
 More options Mar 7 2005, 11:05 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Mon, 7 Mar 2005 17:05:52 +0100
Local: Mon, Mar 7 2005 11:05 am
Subject: Re: .HL_language pragma

MrJoltCola <mrjoltc...@mindspring.com> wrote:
> At 07:50 AM 3/7/2005, Leopold Toetsch wrote:

>> >>   .HL_language Python
> Sounds good to me except that I would prefer you remove the HL_
> and just call it .language to be consistent with other directives.

I don't care much about the actual keyword - as long as we find a
reasonable compromise ;) Anyway, the HL_ prefix should make sure that
it's not mixed up with any kind of string's language declaration. But as
strings don't have a language setting anymore ".language" would be fine
too.

> Incidentally this is what .NET uses as well except its implementation
> uses GUID instead of a string, and it also allows the compiler
> vendor and source document type to be included in the directive.

I don't like GUIDs. I prefer text.

> Dan and I talked about this a couple of years ago on IRC.
> Originally I wanted to stay away from GUIDs as I think they are overkill,
> and had considered allowing ASCII:

Yep.

> .language Perl6
> .language Perl6:ThePerlFoundation
> But..., this requires this section in the bytecode to be variable sized,

No. All that kind of information should either go into PBCs metadata or
stored as PMC constants:

  .const .Version $P0 = "vendor=>tpf,author=>mel,version=0.815"

or whatever. It's up to the Version PMC to parse the passed in string
and freeze it appropriately.

The constant PMC syntax is used already for subroutines. We'd need just
to switch to freeze/thaw for PMC constants.

WRT .language: that should be just a plain string.

> In any case, it needs to be fixed width in the bytecode header.

Not really. Metadata are in separate sections or .language becomes a
string constant.

> We need to revisit the bytecode format. Last time through, I put
> an "Opcode type" at some offset, per Dan's request.

You mean C<opcodetype> in the PBC header? That's still unused. But there
is:

#define OPCODE_TYPE_PERL 0x5045524c
#define OPCODE_TYPE_PYTHON 0x5045524b
#define OPCODE_TYPE_JAVA 4871757
#define OPCODE_TYPE_MSNET 2e4e4554

which defines 4-byte char constants denoting the language, somehow.

> We store a magic number for that. I'm pretty sure we can use
> this field to identify the language using whatever is provided in the
> .language pragma, but I can't speak for Dan. I think he might
> have had different plans for opcode type.

Well, it seems to be that. But we want and additional type mapping for
Parrot standard types. So that doesn't fit there anyway.

> -Melvin

leo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »