How to get environment variables?

2003-11-03 Thread Andrew Shitov
Is it possible to get environment variables from perl6 programme? It 
failes when I try to use perl5 hash %ENV. Thanks.



Re: How to get environment variables?

2003-11-03 Thread Andrew Shitov
I tried this one-line programme for example:

my %e = %ENV;

and got this (parrot-0.0.13/perl are built under mandrake linux):

Global '_HV_ENV' not found
Error: '/parrot-0.0.13/parrot -r env.imc ' failed with exit code 1
Stopped at /parrot-0.0.13/languages/perl6/perl6 line 339
	main::mydie(256,'/parrot-0.0.13/parrot -r env.imc ') called at 
/parrot-0.0.13/languages/perl6/perl6 line 819
	main::pass4('env.imc','env.warn') called at 
/parrot-0.0.13/languages/perl6/perl6 line 741
	main::pass2('env.imc','env.warn') called at 
/parrot-0.0.13/languages/perl6/perl6 line 435
	main::output_tree('P6C::prog=ARRAY(0x8ef6e5c)','env.p6','env.warn') 
called at /parrot-0.0.13/languages/perl6/perl6 line 500
	main::pass1('Parse::RecDescent=HASH(0x8f2ed70)','env.p6','env.warn','undef') called at /parrot-0.0.13/languages/perl6/perl6 line 562
	main::run() called at /parrot-0.0.13/languages/perl6/perl6 line 219

Are you sure you're using the Perl 6 hash syntax? (%ENV{FOO} rather than Perl
5-style $ENV{FOO})
What version of Perl 6 are you using?



How to read and write files?

2004-04-17 Thread Andrew Shitov
I think I have somesing missed: is it possible to open (that is read and 
write) files in perl6 programmes? Those programmes that can be run under
current parrot release.

Thanks.



Re: Why do users need FileHandles?

2004-07-18 Thread Andrew Shitov
DW   my $text is TextFile(/tmp/bar);
DW   $text = hello; # writes, truncates
DW   $text ~= , world\n; # appends

DW   $text.print again\n; # for old-times sake

Anyhow we still need $text.flush() or $text.close() methods.

--

, [EMAIL PROTECTED]




Re[2]: zip with ()

2005-08-01 Thread Andrew Shitov
Is it possible to avoid significance of whitespaces?

I think, such an aspect of Perl 6 would be awful.

IB Whitespace is significant:

IB say zip(@odd, @even);
IB say zip (@odd, @even);

--
___
Andrew, [EMAIL PROTECTED]
___



Re[2]: zip with ()

2005-08-01 Thread Andrew Shitov
TTS BTW, you didn't mean originally:

TTSsay zip (@odd), (@even); # prints 13572468 or 12345678?

That is exactly like with similar printing result of sub() call:

 print sqrt (16), 5; # shout print 45.



--
___
Андрей, [EMAIL PROTECTED]
___



Re[2]: zip with ()

2005-08-01 Thread Andrew Shitov
LP my $x = (1,2,3,4,5);
LP Looks like an error more than anything else.

'Perl 6 and Parrot Essentials' think different ;-)

--
___
Andrew, [EMAIL PROTECTED]
___



Is Perl 6 too late?

2007-05-03 Thread Andrew Shitov
=HI!
To avoid any uncertainty: the subject is a parody for similar
discussion on perl6-internals@ about Parrot.


=FOREWORD
What I want to say is that after N years of developing Perl 6 we do
not have a practical (P in Perl stands for Practical) tool which can
work in real life.

Even worse: today there is no way to speed up the interpreter - it is
good for parsing the language but is very slow for real applications.
(mod_pugs is not the case while there is no command-line tool).


=EXPLANATION
We have Pugs to play with. We have no tool to run with.

Current Pugs have options to compile the programme into several
intermediate languages, for example PIR:

You can
pugs -CPIR helloworld.pl  helloworld.pir

But you cannot later do this:
pugs -BPIR helloworld.pir

Standalone parrot does not help.


=WHAT IS TO BE DONE
What is nedded is a very simple step: complete the Pugs compiler so
that it could provide good PASM (PIR). Going this way we will achieve
the main goal: it will be possible to use hi-speed applications
written in Perl 6 today. No care the language itself is not fully
standardized.

It will change the status of 'conception' and 'project'
to 'utilizing' and 'using'.


=CUT
A bit of fun is that three years ago the situation was better: language
was more poor, the tools for more pure. In April of 2004 I made
a toy server with demos of how real Perl 6 works on a web-server. There
was a bit of examples with comments in Russian that were written on
real Perl 6 of that day, compiled into Parrot bytecode (.pbc) and run
on Apache under Parrot virtual machine. I cannot do the same with
today's instrumentary (or maybe I do not know how to?).


Thank you for understanding :-)


--
Andrew Shitov
__
[EMAIL PROTECTED] | http://www.shitov.ru



Re: explicit line termination with ;: why?

2007-05-14 Thread Andrew Shitov
 I don't want to argue about the design of perl6[1], I just wonder: why
 the semicolon is still needed in the end of lines in perl6?

JavaScript allows to omit semicolumn. In lecture at Yahoo's YUI
Theatre one of JS's gurus talked about how it is organized in
JavaScript parser.

If the line of code is not ended with ';' the parser tries first
to assume that the next line continues current one. If then syntax error
occurs, the parser _goes_back_ and make another asumption that previous
line was ended with semicolumn.

Probably there are much more than one way to implement ';'-less but it
either slows down the compiler or makes grammar more complex.

And in fact Perl 6 already allows not to type ';' at the end of
{block} ;-)

The following simple snippets work correctly with Pugs and perl5:

 perl 6
sub debug ($value)
{
say $value
}
debug 'me'


# perl 5
sub debug
{
   print shift
}
debug 'me'


And finally, Perl is not an Assembler with one only instrucion per
line.


--
Andrew Shitov
__
[EMAIL PROTECTED] | http://www.shitov.ru



Re[2]: explicit line termination with ;: why?

2007-05-14 Thread Andrew Shitov
 JavaScript allows to omit semicolumn.

Sorry, s/lumn/lon/.

By the way, Perl also ignors semicolumn :-)



--
Andrew Shitov
__
[EMAIL PROTECTED] | http://www.shitov.ru



Re[2]: explicit line termination with ;: why?

2007-05-14 Thread Andrew Shitov
 Aankhen wrote:

 Speaking of JavaScript, any experienced JavaScript programmer will
 tell you that while semi-colons are in fact optional, you should
 always treat them as mandatory, to avoid subtle errors creeping into
 your code.

We should also note that the idea of omitting ';' is not as simple as
\n always means ;\n. In mentioned JavaScript language one can
do this:

script
var
x
=
123
alert
(
x
)
/script

and that will work!

;\n can almost always be converted into \n but not vice versa.


--
Andrew Shitov
__
[EMAIL PROTECTED] | http://www.shitov.ru



Re: Rakudo Perl 6 development release #28 (Moscow)

2010-04-22 Thread Andrew Shitov
Moscow.pm also reminds that today (22 Apr) is the birthday of Lenin :-)

 March 2010 development release of Rakudo Perl #28 Moscow.

-- 
Andrew Shitov
__
a...@shitov.ru | http://shitov.ru