Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Default program

6 views
Skip to first unread message

Brent 'Dax' Royal-Gordon

unread,
Apr 1, 2004, 3:05:12 AM4/1/04
to perl6-l...@perl.org
I had a thought tonight.

Perl has a general principle that, in the absence of any indication
otherwise, it should use a sensible default. This default generally
matches the most common use of the feature by new programmers. This
principle is reflected in Perl 6's design in many ways--$_, sort's
default behavior, the @_ list, etc.

I think that Perl 6 should apply that to the entire program. If the
whole program consists of an empty string, it should substitute in a
sensible default program.

I have done extensive research on the Internet and printed Perl books,
and have concluded that the single most common Perl program is the
following:

print "Hello world!\n";

Therefore, I recommend that, when given an empty program or -e string,
Perl 6 should print "Hello world!", emit a newline, and exit. I believe
that this feature would be fairly trivial to implement.

On the other hand, the current behavior may be somewhat entrenched, and
might break our promise to assume that code is Perl 5 until we see a
different indication. As an alternative, perhaps the -H command-line
switch could be used to use a "hello world" program.

--
Brent "Dax" Royal-Gordon <br...@brentdax.com>
Perl and Parrot hacker

Oceania has always been at war with Eastasia.

Elizabeth Mattijsen

unread,
Apr 1, 2004, 3:12:46 AM4/1/04
to Brent 'Dax' Royal-Gordon, perl6-l...@perl.org
At 00:05 -0800 4/1/04, Brent 'Dax' Royal-Gordon wrote:
>On the other hand, the current behavior may be somewhat entrenched, and
>might break our promise to assume that code is Perl 5 until we see a
>different indication. As an alternative, perhaps the -H command-line
>switch could be used to use a "hello world" program.

I think we need to consider all of the implications here: "Hello
World" is very english centric, so I would assume that Perl 6 would
need investigate the locale and change the text to "Monde, Allo!" if
you're using a French locale, "Hallo, Welt!" for German locale, and
"1 april!" for Dutch. ;-)


Liz

Austin Hastings

unread,
Apr 1, 2004, 4:49:02 AM4/1/04
to perl6-l...@perl.org
--- Brent 'Dax' Royal-Gordon <br...@brentdax.com> wrote:
> I had a thought tonight.
>
> Perl has a general principle that, in the absence of any indication
> otherwise, it should use a sensible default. This default generally
> matches the most common use of the feature by new programmers. This
> principle is reflected in Perl 6's design in many ways--$_, sort's
> default behavior, the @_ list, etc.
>
> I think that Perl 6 should apply that to the entire program. If the
> whole program consists of an empty string, it should substitute in a
> sensible default program.

This makes perfect sense.

> I have done extensive research on the Internet and printed Perl
> books, and have concluded that the single most common Perl program
> is the following:
>
> print "Hello world!\n";

In P6, that would be:

say "Hello, world!";

> Therefore, I recommend that, when given an empty program or -e
> string, Perl 6 should print "Hello world!", emit a newline, and
> exit. I believe that this feature would be fairly trivial to
> implement.

I cannot agree with this.

In fact, if someone types "perl" on the command line without any
arguments, it seems obvious to me that they are intending to begin
development of a script.

As such, I think that we should refocus the parrot team's priority.
Instead of wasting valuable coding time winning the Parrathon, it would
be better to provide a functional elisp compiler targeted at the parrot
VM. This way, a naked invocation of "perl" would bring up a script
development system (emacs, ported to parrot: pmacs?) for further work.

Since the emacs codebase is already ported to many platforms, it should
be trivial to add this to the core perl distribution. Perhaps Simon
would agree to lead this effort?

> Brent "Dax" Royal-Gordon <br...@brentdax.com>
> Perl and Parrot hacker

Cheers,

=Austin

Simon Cozens

unread,
Apr 1, 2004, 4:53:11 AM4/1/04
to perl6-l...@perl.org
austin_...@yahoo.com (Austin Hastings) writes:
> Since the emacs codebase is already ported to many platforms, it should
> be trivial to add this to the core perl distribution. Perhaps Simon
> would agree to lead this effort?

I would laugh, but http://search.cpan.org/~jtobey/Emacs-EPL-0.7/

--
On our campus the UNIX system has proved to be not only an effective software
tool, but an agent of technical and social change within the University.
- John Lions (U. of NSW)

Austin Hastings

unread,
Apr 1, 2004, 5:06:13 AM4/1/04
to Simon Cozens, perl6-l...@perl.org

> -----Original Message-----
> From: si...@alibi.simon-cozens.org
>
> austin_...@yahoo.com (Austin Hastings) writes:
> > Since the emacs codebase is already ported to many platforms, it should
> > be trivial to add this to the core perl distribution. Perhaps Simon
> > would agree to lead this effort?
>
> I would laugh, but http://search.cpan.org/~jtobey/Emacs-EPL-0.7/

!!

Richard Nuttall

unread,
Apr 1, 2004, 6:06:28 AM4/1/04
to Austin_...@yahoo.com, perl6-l...@perl.org

>>Therefore, I recommend that, when given an empty program or -e
>>string, Perl 6 should print "Hello world!", emit a newline, and
>>exit. I believe that this feature would be fairly trivial to
>>implement.
>>
>>
>
>I cannot agree with this.
>
>In fact, if someone types "perl" on the command line without any
>arguments, it seems obvious to me that they are intending to begin
>development of a script.
>
On the DWIM principle, shouldn't Perl then just autoload the DWIM::AI
module and provide as output the script that they are intending to write ?

R.

--
Richard Nuttall
Nuttall Consulting
01353 649878
www.nuttall.uk.net

0 new messages