mission haiku

2003-08-28 Thread Nicholas Clark
I'm not convinced this is very good. But I believe that it is an accurate
mission statement, for at least one of our goals:

  Perl internals slow,
  nigh on unmaintainable.
  So we write parrot.

Nicholas Clark


Re: mission haiku

2003-08-28 Thread Sean O'Rourke
Nicholas Clark [EMAIL PROTECTED] writes:
   Perl internals slow,
   nigh on unmaintainable.
   So we write parrot.

Parrot: not just Perl
but punctuated prowess
perfected -- Befunge.

/s



RE: mission haiku

2003-08-28 Thread Brent Dax

Nicholas Clark:
#   Perl internals slow,
#   nigh on unmaintainable.
#   So we write parrot.

Soon we all decide
That others could use it too.
Cherry trees blossom.

:^)

--Brent Dax [EMAIL PROTECTED]
Perl and Parrot hacker
 
Yeah, and my underwear is flame-retardant--that doesn't mean I'm gonna
set myself on fire to prove it.



Re: mission haiku

2003-08-28 Thread Michael G Schwern
On Thu, Aug 28, 2003 at 12:11:12AM +0100, Nicholas Clark wrote:
 I'm not convinced this is very good. But I believe that it is an accurate
 mission statement, for at least one of our goals:
 
   Perl internals slow,
   nigh on unmaintainable.
   So we write parrot.

Sounds like PONIE.


-- 
Michael G Schwern[EMAIL PROTECTED]  http://www.pobox.com/~schwern/
Beef Coronary


Re: mission haiku

2003-08-28 Thread Nicholas Clark
On Wed, Aug 27, 2003 at 04:14:15PM -0700, Michael G Schwern wrote:
 On Thu, Aug 28, 2003 at 12:11:12AM +0100, Nicholas Clark wrote:
  I'm not convinced this is very good. But I believe that it is an accurate
  mission statement, for at least one of our goals:
  
Perl internals slow,
nigh on unmaintainable.
So we write parrot.
 
 Sounds like PONIE.

Nah. Reasoning there is slightly different. Maybe:

  Perl 6 running late,
  won't run existing CPAN,
  I want a Ponie

Nicholas Clark


Re: [RfC] constant PMCs and classes

2003-08-28 Thread Leopold Toetsch
The issues WRT the union initializer are gone now (can people please 
test, if the program below compiles cleanly now) - but:

- make_COW_* sets flag on the source string [1]
- if that is solved (with a special RO flag, or whatever) we have:
- string_make sets a default type and encoding if these arguments were 
NULL. These constant strings have NULL for encoding/type so during 
string_append as the encodings differ transcode is called - next SIGSEGV 
with NULL encoding pointer.

So using these .rodata-constant STRINGs needs a lot of work.
- COW code (there are problems with COWed stacks anyway)
- transcoding stuff (should be changed to use {strstart, byteidx} and do 
something about default vs NULL type/encoding.

leo

[1] this was called via string_copy in the spf_vtable code (I don't see 
the point, why a string should be copied just to print it - removed)

#include parrot/parrot.h
#include parrot/embed.h
#if ! DISABLE_GC_DEBUG
#  define GC_DEBUG_VERSION ,0
#else
#  define GC_DEBUG_VERSION
#endif
#define PCONCAT(b,c) _Parrot_static_##b##c
#define PARROT_DECLARE_STATIC_STRING(name, cstring) \
   static const char PCONCAT(name,_cstring) * = cstring; \
   static const struct parrot_string_t \
  PCONCAT(name,_STRING) = { \
  { /* pobj_t */ \
 {{ \
(void*)PCONCAT(name,_cstring), \
sizeof(PCONCAT(name,_cstring)) \
 }}, \
 PObj_constant_FLAG \
 GC_DEBUG_VERSION \
  }, \
  sizeof(PCONCAT(name,_cstring)), \
  (void*)PCONCAT(name,_cstring), \
  sizeof(PCONCAT(name,_cstring)) - 1, \
  NULL, \
  NULL, \
  0 \
   }, * const name = PCONCAT(name,_STRING)
int main(int argc, char* argv[]) {
int dummy_var;
struct Parrot_Interp * interpreter;
PARROT_DECLARE_STATIC_STRING(mystr, some string here);
interpreter = Parrot_new();
Parrot_init(interpreter, (void*) dummy_var);
PIO_printf(interpreter, %S\n, mystr);
return 0;
}







Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Juergen Boemmels
Hello,

last week I send in a patch which creates io/io_private.h, but nobody
replied to it. The classical Warnock's Dilemma. I have the strange
feeling that its because nobody read my mail, because sometimes the
p6i mailinglist does not like mail with attachments. But otherwise it
made its way to
http://nntp.x.perl.org/group/perl.perl6.internals/17670
so somebody should have read it.

Anyway, I can resend it, resend it with the patch inline or put it in
the bug-tracker. What should I do?

bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47


Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Leopold Toetsch
Juergen Boemmels [EMAIL PROTECTED] wrote:
 Hello,

 last week I send in a patch which creates io/io_private.h, but nobody
 replied to it. The classical Warnock's Dilemma. I have the strange
 feeling that its because nobody read my mail,

Sorry, forgot about that patch. Applied, thanks for your patches and the
reminder ;-)

leo


[PATCH] stoopid find_global behavior fix

2003-08-28 Thread Luke Palmer
find_global throws an exception even if the variable in that entry is
undef, which is just silly.   This patch fixes it to only throw an
exception when it hasn't actually been store_global'd.

I personally think that it should never throw an exception -- that it
should always just return undef if the variable wasn't defined.  OTOH,
some languages like to know whether a variable exists.  I think a nice
solution would be to give the program access to the stash PMC, and then
they can do whatever they like to it.

Luke


Index: var.ops
===
RCS file: /cvs/public/parrot/var.ops,v
retrieving revision 1.7
diff -u -r1.7 var.ops
--- var.ops 23 Aug 2003 15:41:31 -  1.7
+++ var.ops 28 Aug 2003 11:03:11 -
@@ -250,16 +250,19 @@
 
 op find_global(out PMC, in STR) {
 opcode_t * resume;
+PMC* key = key_new_string(interpreter, $2);
 if (!$2)
 internal_exception(1, Tried to get null global.);
-$1 = VTABLE_get_pmc_keyed(interpreter,
-   interpreter-perl_stash-stash_hash,
-   key_new_string(interpreter, $2));
+
 resume = expr NEXT();
-/* XXX doesn't work if the global is an undefined var */
-if (!VTABLE_defined(interpreter, $1))
+if (!VTABLE_exists_keyed(interpreter,
+   interpreter-perl_stash-stash_hash, key)) 
 real_exception(interpreter, resume, GLOBAL_NOT_FOUND,
-Global '%s' not found, string_to_cstring(interpreter, $2));
+Global '%s' not found\n, string_to_cstring(interpreter, $2));
+   
+$1 = VTABLE_get_pmc_keyed(interpreter,
+   interpreter-perl_stash-stash_hash, key);
+
 restart ADDRESS(resume);
 }
 


Preprocessing recursion

2003-08-28 Thread Vladimir Lipskiy
D:\build\parrotnmake

...

cl -nologo -Od -MD -Zi -DDEBUGGING -DWIN32 -D_CONSOLE -DNO_STRICT
I../include -Focsub.obj -c csub.c
csub.c
csub.pmc(47) : error C2039: 'ptrs' : is not a member of '__unnamed'
../include\parrot/pobj.h(38) : see declaration of '__unnamed'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

Seems like my MSVC++ 6.0 preprocesses

#define struct_val ptrs.struct_val

as

ptrs.ptrs.struct_val

'cause the error dissapears when I add an underscore to struct_val:

typedef union UnionVal {
...
struct {/* PMC unionval members */
DPOINTER* _struct_val;   /* two ptrs, both are defines 
...
} UnionVal;




Re: Embedding Parrot in Perl

2003-08-28 Thread Juergen Boemmels
Benjamin Goldberg [EMAIL PROTECTED] writes:

 Luke Palmer wrote:
  
  I started working on some XS code for embedding a Parrot interpreter in
  Perl.  I ran into a few problems:
  
  1) I don't know XS :-)   (good way to learn, though)
  
  2) What do I put as stacktop in Parrot_init()?  I can't just use a
 local variable in the calling function, because it will return and
 there might be something lower than that later...
 
 If our DoD is no longer walking the C stack, then stacktop should no
 longer be needed.  Until the code is changed, just pass NULL.

AFAIK, the stack is still walked. (I don't like this but thats a
diffrent story). So Parrot_init() should be called with a real
stacktop.  A typical codefragment to do this is:

struct Parrot_Interp *interpreter;
interpreter = Parrot_new();
Parrot_init(interpreter, interpreter);

  3) I'd like to have the PIR compiler available to this embedded
 interpreter.  What would be the best way to do that?

IMCC implements the (static) functions imcc_compile_pir and
imcc_compile_pasm in parser_util.c. You can take a look at them. But
be careful imcc uses some global data in the parser and the lexer, so
this is not reentrant.

bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47


Re: Embedding Parrot in Perl

2003-08-28 Thread Leopold Toetsch
Juergen Boemmels [EMAIL PROTECTED] wrote:
 Benjamin Goldberg [EMAIL PROTECTED] writes:
 If our DoD is no longer walking the C stack, then stacktop should no
 longer be needed.  Until the code is changed, just pass NULL.

 AFAIK, the stack is still walked. (I don't like this but thats a
 diffrent story). So Parrot_init() should be called with a real
 stacktop.  A typical codefragment to do this is:

The stack is walked, but only from bottom up to the stack at run-loop
level (at least it should be, lo_var_ptr isn't set properly yet).
The extra argument for Parrot_init can go away. There is nothing
unanchored on the stack, when the interpreter starts running.

 bye
 boe

leo


Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Lars Balker Rasmussen
Juergen Boemmels [EMAIL PROTECTED] writes:
 I have the strange
 feeling that its because nobody read my mail, because sometimes the
 p6i mailinglist does not like mail with attachments. 

That's ezmlm-idx which doesn't like Gnus' minimalistic approach to
Content-type in text-attachments.  I've patched my Gnus to be slightly
more verbose, which has fixed it for me (as seen in this message).

Fixing ezmlm-idx is a bit more demanding...

--- mml.el~	Tue Apr 29 02:52:48 2003
+++ mml.el	Sun Aug  3 01:12:00 2003
@@ -54,6 +54,10 @@
   :type '(repeat (symbol :tag Parameter))
   :group 'message)
 
+(defvar mml-insert-mime-headers-always nil
+  If non-nil, always put at least Content-Type: text/plain at the top 
+of MIME parts. It's necessary to work against a bug in ezmlm.)
+
 (defvar mml-tweak-type-alist nil
   A list of (TYPE . FUNCTION) for tweaking MML parts.
 TYPE is a string containing a regexp to match the MIME type.  FUNCTION
@@ -608,7 +612,8 @@
 (when (or charset
 	  parameters
 	  flowed
-	  (not (equal type mml-generate-default-type)))
+	  (not (equal type mml-generate-default-type))
+	  mml-insert-mime-headers-always)
   (when (consp charset)
 	(error
 	 Can't encode a part with several charsets.))
-- 
Lars Balker Rasmussen  Consult::Perl


Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Dan Sugalski
On 28 Aug 2003, Juergen Boemmels wrote:

 Hello,
 
 last week I send in a patch which creates io/io_private.h, but nobody
 replied to it. The classical Warnock's Dilemma. I have the strange
 feeling that its because nobody read my mail, because sometimes the
 p6i mailinglist does not like mail with attachments. But otherwise it
 made its way to
 http://nntp.x.perl.org/group/perl.perl6.internals/17670
 so somebody should have read it.

I see Leo's got the patch in, but... have we gotten you CVS access yet? 
You're the defacto IO maintainer at the moment, so it'd make sense to do 
so.

Dan



Parrot Z-machine

2003-08-28 Thread Amir Karger
Hi. Hugely newbie at Parroting, but think it's the coolest.

So I was bummed to see that Befunge and BASIC had already been
parroted.  (And Clinton Pierce even ported QuickBasic, which makes my
Language::Basic completely useless. Argh!) Then I thought, What about
Z-machine?! I was surprised to see that it hadn't been ported, and
even more surprised when I saw that Dan et al. really wanted to port it
but hadn't.

So:

- Is it not being ported because of a lack of tuits, or because it's
extremely hard?

- A Perl 6 Summary from last year claimed Josh Wilmes was going to work
on it. Does anyone know if he is and, if so, how far he's gotten?

- Whether or not it's extremely hard, would it be useful to have some
of the easy parts done by a newbie who can hack assembly but not well
enough to put into the parrot core? In that case, which would be the
easy parts?

- I saw that Dan wanted to create a library to handle stack-based
languages. I don't suppose that's been done at all? If not, I could
steal from, e.g., befunge, which would be way better than starting from
scratch. I would offer to create the library, but I'm not really
confident enough about my (as-yet nonexistent) pasm-writing skills to
write a library a bunch of other people use.

- What the heck am I actually supposed to do? I read plenty of FMs but
I'm sure I could still use plenty of guidance.

As you can see, I'm totally clueless, but I'm a fan of Parrot, Perl,
and Z, so it would be a lot of fun (if mostly useless) to get them
working together. With some helpful hints and lots of free time (ha!) I
might actually be able to contribute some.

-Amir Karger


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


Re: Preprocessing recursion

2003-08-28 Thread Leopold Toetsch
Vladimir Lipskiy [EMAIL PROTECTED] wrote:
 struct {/* PMC unionval members */
 DPOINTER* _struct_val;   /* two ptrs, both are defines

Changed like above, thanks.

leo


Re: [PATCH] stoopid find_global behavior fix

2003-08-28 Thread Leopold Toetsch
Luke Palmer [EMAIL PROTECTED] wrote:
 find_global throws an exception even if the variable in that entry is
 undef, which is just silly.   This patch fixes it to only throw an
 exception when it hasn't actually been store_global'd.

Thanks, applied.

 I personally think that it should never throw an exception -- that it
 should always just return undef if the variable wasn't defined.  OTOH,
 some languages like to know whether a variable exists.  I think a nice
 solution would be to give the program access to the stash PMC, and then
 they can do whatever they like to it.

Yep. We need that anyway. We can put the stash pointer into
interpreter-iglobals and retrieve it with the interpreter vtable
interface.

Lexicals should use OrderedHash IMHO, then they would get an iterator
interface for free.

 Luke

leo


Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Leopold Toetsch
Dan Sugalski [EMAIL PROTECTED] wrote:

 I see Leo's got the patch in, but... have we gotten you CVS access yet?
 You're the defacto IO maintainer at the moment, so it'd make sense to do
 so.

Yep. Juergen's patches are fine, I second that.

   Dan

leo


Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Melvin Smith
At 12:04 PM 8/28/2003 +0200, Juergen Boemmels wrote:
Hello,

last week I send in a patch which creates io/io_private.h, but nobody
replied to it. The classical Warnock's Dilemma. I have the strange
feeling that its because nobody read my mail, because sometimes the
p6i mailinglist does not like mail with attachments. But otherwise it
made its way to
http://nntp.x.perl.org/group/perl.perl6.internals/17670
so somebody should have read it.
Actually I reviewed it and didn't have an issues so I didn't respond.
I assumed you already had CVS commit access. If not, you should.
-Melvin




Re: Embedding Parrot in Perl

2003-08-28 Thread Leopold Toetsch
Luke Palmer [EMAIL PROTECTED] wrote:

 2) What do I put as stacktop in Parrot_init()?

Its gone. stacktop is now set internally before entering the run loop.

 Thanks,
 Luke

leo


Re: [RfC] constant PMCs and classes

2003-08-28 Thread Juergen Boemmels
Leopold Toetsch [EMAIL PROTECTED] writes:

 The issues WRT the union initializer are gone now (can people please
 test, if the program below compiles cleanly now) - but:
 
 
 - make_COW_* sets flag on the source string [1]
 - if that is solved (with a special RO flag, or whatever) we have:
 - string_make sets a default type and encoding if these arguments were
 NULL. These constant strings have NULL for encoding/type so during
 string_append as the encodings differ transcode is called - next
 SIGSEGV with NULL encoding pointer.

It is in principle possible to use a default_encoding in the static
initialiser, but then a relocation is needed because the static string
and default_encoding are not in the same object-file. This would lead
to a longer load-time. 

On the other hand accessing the encoding through macros
#define ENCODING_skip_forward(enc, p, n) ((enc) ? \
  (enc)-skip_forward(p, n) : \
  default_enc-skip_forward(p, n))
has a runtime cost; the test will fool the branch prediction.

 So using these .rodata-constant STRINGs needs a lot of work.
 - COW code (there are problems with COWed stacks anyway)
 - transcoding stuff (should be changed to use {strstart, byteidx} and
 do something about default vs NULL type/encoding.

Next idea:
create a new function
STRING *string_from_static_cstring(const char *cstr);
which does not copy the string to newly allocated memory. But maybe
then the problems with COW are still there.

[...]
bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47


Re: mission haiku

2003-08-28 Thread chromatic
On Thursday, August 28, 2003, at 01:44 AM, Nicholas Clark wrote:

On Wed, Aug 27, 2003 at 04:14:15PM -0700, Michael G Schwern wrote:

Sounds like PONIE.
Nah. Reasoning there is slightly different. Maybe:

  Perl 6 running late,
  won't run existing CPAN,
  I want a Ponie
Refactoring: good!
Rewriting takes lots of time.
I want a Ponie.
-- c



Re: Warnocks Dilemma (was Maybe [PATCH] move some stuff out of io.h to io_privat.h)

2003-08-28 Thread Dan Sugalski
At 3:53 PM +0200 8/28/03, Leopold Toetsch wrote:
Dan Sugalski [EMAIL PROTECTED] wrote:

 I see Leo's got the patch in, but... have we gotten you CVS access yet?
 You're the defacto IO maintainer at the moment, so it'd make sense to do
 so.
Yep. Juergen's patches are fine, I second that.
I put in the request, and it's been taken care of. Juergen's now got 
checkin privs--lucky him. :)
--
Dan

--it's like this---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk