I've committed Data::Sort, Data::Replace and Data::Escape.
Data::Sort is a new version of the old library/sort.imc. The old file is still
there, but will be removed soon.
Data::Replace replaces every occurrence of one PMC in a nested data structure
with another PMC.
Data::Escape contains a function "String" that escapes the string.
The libraries are used by Data::Dumper and are also required for the EBNF
parser.
jens
I'm not sure what that means, but Data::Replace seems too vague.
What is it?
> Data::Escape contains a function "String" that escapes the string.
Wouldn't escape_string be better?
(And I wonder how different languages escape strings,
and if there's a common subset that'll work for all/most of them.)
Tim [wearing a tired old namespace police hat]
Presumably individual languages will have their own routines - I would
expect anything in library that isn't in a language-specific directory
to be PIR/PASM specific.
I agree about the namespace issues though. definitely something to keep
an eye on.
Wasn't there talk about Class names in parrot being prefixed by their
language? (in which case we've each got our own namespace to pollute)
--
Will "Coke" Coleda will at coleda
dot com
On Thursday 08 April 2004 23:49, Tim Bunce wrote:
> On Thu, Apr 08, 2004 at 08:28:49PM +0200, Jens Rieks wrote:
> > Data::Replace replaces every occurrence of one PMC in a nested data
> > structure with another PMC.
>
> I'm not sure what that means, but Data::Replace seems too vague.
> What is it?
if you have a data structure [A, B, [C, D, E], C, D, E], where each letter
represents a PMC. With Data::Replace, you can for example replace each D PMC
with another PMC value.
Do you have a better name for it?
> > Data::Escape contains a function "String" that escapes the string.
>
> Wouldn't escape_string be better?
What would be redundant, the namespace already contains "Escape".
> (And I wonder how different languages escape strings,
> and if there's a common subset that'll work for all/most of them.)
Its C and PIR like escaping, it relaces some ASCII code with \n, \t, \r and
replaces ' with \' in strings quoted with ', and " with \" in strings quoted
with ".
> Tim [wearing a tired old namespace police hat]
:-)
jens
Regards,
-- Gregor
--
Gregor Purdy gre...@focusresearch.com
Focus Research, Inc. http://www.focusresearch.com/
Perhaps Data::DeepReplacePMC
(We've learnt the hard way with Perl5 modules names that more words are good.
Keeping module names very short is a false economy.)
> > > Data::Escape contains a function "String" that escapes the string.
> >
> > Wouldn't escape_string be better?
>
> What would be redundant, the namespace already contains "Escape".
You're assuming that the name will always be seen in the context
of it defining module. That may not be the case in the future.
> > (And I wonder how different languages escape strings,
> > and if there's a common subset that'll work for all/most of them.)
>
> Its C and PIR like escaping, it relaces some ASCII code with \n, \t, \r and
> replaces ' with \' in strings quoted with ', and " with \" in strings quoted
> with ".
escape_string_cstyle perhaps
Tim.
And more words that mean something... "Data" ranks right up there as the
worst possible names for anything.
(Nah, "Sys" and "System" are at the top of the list :)
Anyone wanting to act as a guiding light for Perl6 module naming is
very welcome. I've been there and done that once. For ten years.
My time is up.
Tim.
PMC::DeepReplace (Data::Replace)
PMC::Printable (Data::Escape)
PMC::Sort (Data::Sort)
PMC::Dumper (Data::Dumper)
> (We've learnt the hard way with Perl5 modules names that more words are
> good. Keeping module names very short is a false economy.)
If the name isn't good enough, it is not always the best idea to make it just
longer.
> You're assuming that the name will always be seen in the context
> of it defining module. That may not be the case in the future.
"Other language" has to use find_global in order to find the Subs declared in
these libraries. You have to specify the namespace as well as the function
name to lookup the sub ref. The language itself can then store it in a
variable named "escape_string" or something similar.
> > > (And I wonder how different languages escape strings,
> > > and if there's a common subset that'll work for all/most of them.)
> >
> > Its C and PIR like escaping, it relaces some ASCII code with \n, \t, \r
> > and replaces ' with \' in strings quoted with ', and " with \" in strings
> > quoted with ".
>
> escape_string_cstyle perhaps
It is a widely used format.
escape_string_c_and_cpp_and_perl_and_shell_and_so_on_style? ;-)
> Tim.
jens
> On Sat, Apr 10, 2004 at 01:49:37PM +0300, Jarkko Hietaniemi wrote:
>
>>>(We've learnt the hard way with Perl5 modules names that more words are good.
>>
>>And more words that mean something... "Data" ranks right up there as the
>>worst possible names for anything.
>
>
> (Nah, "Sys" and "System" are at the top of the list :)
Sys::Data::System, anyone? (Or *cough* Meta *cough*)
> Anyone wanting to act as a guiding light for Perl6 module naming is
> very welcome. I've been there and done that once. For ten years.
> My time is up.
Amen.