Hello World

The first Grace program is of course Hello World.   In Grace, we expect this to be written simply and straightforwardly, as follows:

No semicolons, no brackets, no method, no class, no package, no “public static void main(magic incantation goes here)”.  Just the core of the code is all that should be need for such a simple program.

14 thoughts on “Hello World

  1. Without the semicolon how could we know that an expression come to end??? using one expression per line??

    I think that students from early years in college could help a lot.

    PS You did’nt leave an email to contact or to send suggestions

  2. Is println a method, whose receiver is implicit? Is it a global function?
    Sophia

  3. To make the object-orientation clear, even in the most simple program, I would suggest:

    display.show(“Hello World!”)

  4. PS You did’nt leave an email to contact or to send suggestions

    Hi José – we’re still getting a hang of the blogging software: it doesn’t seem to notify us when there are pending comments.

    But actually, you’ve done the right thing: if you post comments on the blog, then we can all see them here

  5. Is println a method, whose receiver is implicit? Is it a global function?
    Sophia

    Short answer: yes.

    To make the object-orientation clear, even in the most simple program, I would suggest:

    display.show(“Hello World!”)

    Sure. It’s a question of paradigm vs brevity. We think different pedagogies may want to make different choices: we hope to find was to support them.

    In this case, either “println(..)” or “display” should be able to be set up as a predeclared method or object – so people can design libraries to support their preferred approach.

  6. So, important question here… primarily compiled or interpreted?

    Or is this Hello World example the slimmed down interpreted form of the compiled:

    {
    println(“Hello World”);
    }

    Note that I’m assuming ‘;’ as a command terminator rather than a separator to avoid all that mess that Pascal ran into.

    Your Hello World example also suggests a python-like import statement to pull leaf library routines into the current context with unqualified names. I am making the additional assumption that a small set of routines would be implicitly imported if no explicit import is provided. (Pre-processor perhaps? Or maybe a configurable pre-processor that the prof. can configure to import the defaults based on their preferred style… “println()” vs “out.println()”.)

  7. primarily compiled or interpreted?

    We have this 1970s-era delusion that its possible to separate the definition of a language from its implementation. So we see this as a question for implementations, not the definition.

    Note that I’m assuming ‘;’ as a command terminator rather than a separator to avoid all that mess that Pascal ran into.

    yep – and that can be elided via layout. Somehow.

    Or maybe a configurable pre-processor that the prof. can configure to import the defaults based on their preferred style… “println()” vs “out.println()”.)

    Right. Not really a pre-processor, but a set of imported library routines. The idea is that even the same implementation could support different configurations. This is like Tcl, which typically has at least two or three different configurations – a raw interpreter, “wish” with a UI, “expect” for screen scraping.

  8. You are assuming a global scope in which println will be located. This is unfortunate and unnecessary. Making “Hello wordl” be concise is desirable, bit it is a tooling issue, not a language one. The global scope will eat you alive when you try and deal with modularity.

    As long as you have an IDE where you can express hello world as a concise expression, all will be well. The language need not suffer from a global namespace, with its problematic implications.

  9. You are assuming a global scope in which println will be located

    Actually we’re trying not to assume that. I very much like the flexibility that Newspeak gets with without having a global scope, and hope to have something similar in Grace – although it should certainly be managed by tooling in the programming environments.

  10. Why not simply:

    print “Hello World\n”

    Where the parenthesis are merely aggregators?

    See also Ruby; HelloWorld:

    puts ‘Hello world’

Leave a Reply

Your email address will not be published. Required fields are marked *