The world's shortest 'Hello World!' program: a proposal

L

Larry

Having a superlative description of a language is a great promotional
aid. For example: "best at text processing", "best for distributed web
apps", "fastest for 3d games" etc...

One claim that Perl can make is one of the most simple and shortest
'Hello World' programs.

There is rumor on the web that there is another language which will
execute the code:

Hello World

and print:

Hello World

My proposal for Perl6 is to make Perl execute a sequence of code which
is 0 bytes in length with the action of printing to STDOUT:

Hello World

Currently, attempting to execute a file or string of code with no
content will do absolutely nothing.

Of course, with the -W flag, Perl would continue to do nothing, and if
one were to use strict, it would no longer be an empty file and
therefore would properly execute by strictly doing absolutely nothing.

The controversy in this proposal may be the way in which to state:

Hello World

Here are a few alternatives that have been used traditionally:

Hello, World
Hello, World!
Hello world.
hello world...

And with the current aggressiveness of Nasa in exploring new worlds,
one might consider changing it to:

Hello Worlds!
 
K

Ken

Larry said:
Having a superlative description of a language is a great promotional
aid. For example: "best at text processing", "best for distributed web
apps", "fastest for 3d games" etc...

One claim that Perl can make is one of the most simple and shortest
'Hello World' programs.

There is rumor on the web that there is another language which will
execute the code:

Hello World

and print:

Hello World

My proposal for Perl6 is to make Perl execute a sequence of code which
is 0 bytes in length with the action of printing to STDOUT:

Hello World

Currently, attempting to execute a file or string of code with no
content will do absolutely nothing.

Of course, with the -W flag, Perl would continue to do nothing, and if
one were to use strict, it would no longer be an empty file and
therefore would properly execute by strictly doing absolutely nothing.

The controversy in this proposal may be the way in which to state:

Hello World

Here are a few alternatives that have been used traditionally:

Hello, World
Hello, World!
Hello world.
hello world...

And with the current aggressiveness of Nasa in exploring new worlds,
one might consider changing it to:

Hello Worlds!

lol (this IS a joke, right?)

Ken
 
A

Alfred Z. Newmane

A. Sinan Unur said:
Please stop feeding the troll.

Sinan.

Why is he (the OP I assume you were referring to) automatically a troll?
Seemed like a totally harmless "ha ha" orientated question. (If the
person has otherwise truely proved to be a "troll", then I apologize in
advance.)

And if you really think about it, printing /something/ for a completely
empty program (0 bytes), such as version info, rather then a variant of
"hello world", could be useful.

Or how about this, when configuration Perl for the first time, have a
question/option to change the default behavior for 0 byte programs
(default being the do nothing) with the printing of some useful
information, like version, or a 3rd option to print "hello World"
instead. That way everyone can be happy.

Could be useful. :)
 
C

chris-usenet

Larry said:
The controversy in this proposal may be the way in which to state:
Hello World
Here are a few alternatives that have been used traditionally:
Hello, World
Hello, World!
Hello world.
hello world...
Hello Worlds!

You've missed out the canonical grandfather of them all (Kernigan and
Ritchie, "The C Programming language"):

ObPerl
print "hello, world\n"

Chris
 
L

Leonard Challis

A. Sinan Unur said:
Please stop feeding the troll.

Sinan.

That exactly what I mean about people getting flamed for no reason.
Seems to me some people have real social problems. It's a shame.

Lenny
 
M

Michele Dondi

Having a superlative description of a language is a great promotional
aid. For example: "best at text processing", "best for distributed web
apps", "fastest for 3d games" etc...

Do we need more script kiddies, by any chance?
One claim that Perl can make is one of the most simple and shortest
'Hello World' programs.

I wouldn't think this as of being one of its strongest point nor one
of the reasons I love it so much, but...
There is rumor on the web that there is another language which will
execute the code:

Hello World

and print:

Hello World

Good for them!

FWIW I would fear such a "feature".
My proposal for Perl6 is to make Perl execute a sequence of code which

Please note that you should make your proposals for Perl6 in p6l.

I think you'll find, as I did myself, that people here is more
concerned, and by large, with how to do stuff in perl, rather than in
discussions about proposals about Perl{5,6}. (Even if I personally
whish there were more activity/responsiveness in this sense, but it
doesn't count.)

As a side note indeed large parts of Perl6's syntax and semantics are
still being actively redefined, rethought, etc. _but_ I doubt
(s/doubt/am sure/) that a similar proposal could ever be accepted, let
alone the motivations you gave for it...
is 0 bytes in length with the action of printing to STDOUT:

_What_ is "0 bytes in length"? I can't see anything in your example!!
Currently, attempting to execute a file or string of code with no
content will do absolutely nothing.

HUH?!? What is "string of code with no content". Note that the empty
program _is_ a valid program, and it's also the simples trie, in that
it _does_ print itself, i.e. nothing.
Of course, with the -W flag, Perl would continue to do nothing, and if

It's a particular idea of yours that "perl does nothing" when you give
it a script containing e.g. "hello world\n" and nothing else: it does
a whole lot of things, and it emits an error.
one were to use strict, it would no longer be an empty file and
therefore would properly execute by strictly doing absolutely nothing.

Another thing that you'll find out it that in Perl6 strict and
warnings will be turned on _by default_ in most cases, with the most
notable exception being given by one-liners specified by means of -e.
The controversy in this proposal may be the way in which to state:

Hello World

Here are a few alternatives that have been used traditionally:

Hello, World
Hello, World!
Hello world.
hello world...

WHich drug are you taking? Can I have some?!?
And with the current aggressiveness of Nasa in exploring new worlds,
one might consider changing it to:

Hello Worlds!

Wow, I didn't expect you to have such a brilliant sense of humor...


Michele
 
M

Michele Dondi

Larry wrote:
[snip 45 more lines]
lol (this IS a joke, right?)

I don't think so, but I'm not really sure the OP is a troll either.
But then why quoting his whole message (which is alread a waste of
electrons in the first place)? Well, I see, your cmt applies to all of
it, so in some sense it does make sense, but... oh, well: you have
trimmed it down. All in all you're right: if it were a joke, then it
would have been funny after all!


Michele
 
T

Tad McClellan

Leonard Challis said:
That exactly what I mean about people getting flamed for no reason.


Have you considered that there might _be_ a reason, but that you do
not know what it is?

There is always a reason, IMO.

The debate could be about whether or not it is a good reason though.
 
L

Leonard Challis

Heh, I guess your right. I admit there probably is a reason and whatever it
is I apologise.

Some people do seem to be quite untowards however, no matter the
circumstance, creating a mixed atmosphere.

Lenny
 
W

Wes Groleau

Hue-Bond said:
Hmm? How could an empty program *print* something? Even if that something is
the empty string.

Nothing in, nothing out. Basic computer science.

--
Wes Groleau

A pessimist says the glass is half empty.

An optimist says the glass is half full.

An engineer says somebody made the glass
twice as big as it needed to be.
 
A

A. Sinan Unur

Nothing in, nothing out. Basic computer science.

Actually, that is "Garbage in, garbage out".

C:\Home\asu1\UseNet\clpmisc> perl -e
No code specified for -e.

Nothing in, something out.

Sinan.
 
A

Arndt Jonasson

A. Sinan Unur said:
Actually, that is "Garbage in, garbage out".

C:\Home\asu1\UseNet\clpmisc> perl -e
No code specified for -e.

Nothing in, something out.

arndt ~/perl 4011> perl -e ''
arndt ~/perl 4012>

Empty in, empty out. (No, I didn't say "nothing".)
 
M

Michele Dondi

Of course, it's 0 bytes ;^).
;-)


Hmm? How could an empty program *print* something? Even if that something is
the empty string.

I think this may get more into phyolosophy than computer programming.
But _no_ output is the output of an "empty" print, thus the effects
are indistinguishable. Since we're talking about _output_ this point
of view seems sensible to me. If you want to take into account
"internal degrees of freedom", then yes: in one case you have a call
to print() and in one you don't. Does it matter?


Michele
 
L

Leonard Challis

I think the _original_ point was that if you had "script.pl" and that
contained _no_ data, instead of doing nothing, the Perl Interpreter cheekily
outputted "Hello World!" or something.

Let us not argue! :D
Lenny
 
E

Eric Schwartz

Leonard Challis said:
I think the _original_ point was that if you had "script.pl" and that
contained _no_ data, instead of doing nothing, the Perl Interpreter cheekily
outputted "Hello World!" or something.

Only, it doesn't.

emschwar@wilson:~$ touch script.pl
emschwar@wilson:~$ perl script.pl
emschwar@wilson:~$

-=Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top