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

Discussion in 'Perl Misc' started by Larry, Jan 18, 2005.

  1. Larry

    Larry Guest

    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!
     
    Larry, Jan 18, 2005
    #1
    1. Advertisements

  2. Larry

    Ken Guest

    lol (this IS a joke, right?)

    Ken
     
    Ken, Jan 18, 2005
    #2
    1. Advertisements

  3. Lol, I can't tell if it is or not, but it would be quit funny :D
    Lenny
     
    Leonard Challis, Jan 18, 2005
    #3
  4. Please stop feeding the troll.

    Sinan.
     
    A. Sinan Unur, Jan 18, 2005
    #4
  5. Larry

    Wes Groleau Guest

    As in funny enough to make me quit.
     
    Wes Groleau, Jan 19, 2005
    #5
  6. 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. :)
     
    Alfred Z. Newmane, Jan 19, 2005
    #6
  7. Larry

    chris-usenet Guest

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

    ObPerl
    print "hello, world\n"

    Chris
     
    chris-usenet, Jan 19, 2005
    #7
  8. 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
     
    Leonard Challis, Jan 19, 2005
    #8
  9. Do we need more script kiddies, by any chance?
    I wouldn't think this as of being one of its strongest point nor one
    of the reasons I love it so much, but...
    Good for them!

    FWIW I would fear such a "feature".
    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...
    _What_ is "0 bytes in length"? I can't see anything in your example!!
    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.
    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.
    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.
    WHich drug are you taking? Can I have some?!?
    Wow, I didn't expect you to have such a brilliant sense of humor...


    Michele
     
    Michele Dondi, Jan 19, 2005
    #9
  10. [snip 45 more lines]
    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
     
    Michele Dondi, Jan 19, 2005
    #10
  11. [snip 47 more lines]
    And did you really need to include a full quote of a message already
    including a quote of the whole OP's immortal prose, just to add this
    pearl of wisdom?!?


    Michele
     
    Michele Dondi, Jan 19, 2005
    #11

  12. 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.
     
    Tad McClellan, Jan 20, 2005
    #12
  13. 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
     
    Leonard Challis, Jan 20, 2005
    #13
  14. Larry

    Wes Groleau Guest

    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.
     
    Wes Groleau, Jan 20, 2005
    #14
  15. 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. Sinan Unur, Jan 20, 2005
    #15
  16. arndt ~/perl 4011> perl -e ''
    arndt ~/perl 4012>

    Empty in, empty out. (No, I didn't say "nothing".)
     
    Arndt Jonasson, Jan 20, 2005
    #16
  17. Larry

    phaylon Guest

    Why?
     
    phaylon, Jan 20, 2005
    #17
  18. 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
     
    Michele Dondi, Jan 20, 2005
    #18
  19. 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
     
    Leonard Challis, Jan 20, 2005
    #19
  20. Only, it doesn't.

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

    -=Eric
     
    Eric Schwartz, Jan 20, 2005
    #20
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.