Well, it all depends what you mean by Hello World. In the C tradition, the goal of creating some minimal code that does something useful is conflated with creating a complete program and packaging it, because there is no other option. In the civilized world, there is a spectrum, (1) The simplest thing (what I would put in a tutorial) is to type 'Hello World' in a workspace and evaluate it. Here Hello World is a is an expression. This is in keeping with the role of Hello world as an introduction to creating code. There is also the method 'out, whose future disposition is in doubt, as in 'Hello World' out which prints to the JS console. Here Hello World is still an expression, but feels more like an imperative statement causing something to happen. There are questions around #out that are orthogonal to the options I present here: a. #out provides global capability. How harmful is it if we allow universal access to it? In Unix terms, is the output stream a universal capability? We do allow the error stream as a universal capability (almost) since we allow any program to raise an exception via the Error method of Object. A thorough security review might lead us to prohibit that too. b. There should be a Newspeak object like Transcript in the Smalltalk system, which you can use as that capability. Should that object be part of Platform? The IDE? Should the IDE provide an augmented platform where Object supports such a convenience, (or others, like #break?). I feel that in the development setting, #out or access to Transcript via Object is essential. But that may not carry through to the production environment. If we don't have #out, we can certainly use Transcript in the IDE, as in Transcript show: 'Hello World' (2) class HelloWorld = ( 'Hello World' out. )(). This is more like defining Hello World as a program or library. If we want this to work outside the IDE and decide that access to #out is forbidden, we get class HelloWorld onConsole: Transcript = ( Transcript show: 'Hello World'. )() (3) class HelloApp packageUsing: manifest = () ( |
public main: platform args: args = ( |
'Hello World' out. |
)) or class HelloApp packageUsing: manifest = ( | Transcript = manifest Transcript. | ) |
public main: platform args: args = ( |
Transcript show: 'Hello World'. )) |
Now we have Hello World as a full application. (4) Lastly we have something like your proposal, in which Hello World is a DOM application - involving things like FFI to JS and GUI. While this is an option, I try and pave over JS whenever possible. |
--
You received this message because you are subscribed to the Google Groups "Newspeak Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to newspeaklangua...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/newspeaklanguage/f0ce65f5-cc02-4f29-abf6-06a46dd13380n%40googlegroups.com.
Well, it all depends what you mean by Hello World.
In the C tradition, the goal of creating some minimal code that does something useful is conflated with creating a complete program and packaging it, because there is no other option. In the civilized world, there is a spectrum,\
(1) The simplest thing (what I would put in a tutorial) is to type
'Hello World'
in a workspace and evaluate it. Here Hello World is a is an expression. This is in keeping with the role of Hello world as an introduction to creating code.
There is also the method 'out, whose future disposition is in doubt, as in
'Hello World' out
which prints to the JS console.
Here Hello World is still an expression, but feels more like an imperative statement causing something to happen.
There are questions around #out that are orthogonal to the options I present here:
a. #out provides global capability. How harmful is it if we allow universal access to it? In Unix terms, is the output stream a universal capability? We do allow the error stream as a universal capability (almost) since we allow any program to raise an exception via the Error method of Object. A thorough security review might lead us to prohibit that too.
b. There should be a Newspeak object like Transcript in the Smalltalk system, which you can use as that capability. Should that object be part of Platform? The IDE? Should the IDE provide an augmented platform where Object supports such a convenience, (or others, like #break?). I feel that in the development setting, #out or access to Transcript via Object is essential. But that may not carry through to the production environment.
If we don't have #out, we can certainly use Transcript in the IDE, as in
Transcript show: 'Hello World'
(2) class HelloWorld = ( 'Hello World' out. )(). This is more like defining Hello World as a program or library. If we want this to work outside the IDE
and decide that access to #out is forbidden, we get
class HelloWorld onConsole: Transcript = (
Transcript show: 'Hello World'.
)()
(3)
class HelloApp packageUsing: manifest = () (
public main: platform args: args = (
'Hello World' out.
))
or
class HelloApp packageUsing: manifest = (
| Transcript = manifest Transcript. |
)
public main: platform args: args = (
Transcript show: 'Hello World'.
))
Now we have Hello World as a full application.
(4) Lastly we have something like your proposal, in which Hello World is a DOM application - involving things like FFI to JS and GUI. While this is an option, I try and pave over JS whenever possible.
To view this discussion on the web visit https://groups.google.com/d/msgid/newspeaklanguage/e91c2930-015e-4cc5-9ae8-3df85776f204n%40googlegroups.com.
Hi Milan,a. Transcript does not yet exist in the Web version. A trivial version would leverage #out:class Transcript = ()():(show: x <String> = (x out))
However, we really want something with a UI, integrated into the IDE UI. Not very hard, but I haven't done it. See https://github.com/newspeaklanguage/newspeak/issues/76.As it stands, #out writes to the JS console.
This has pros and cons. One might choose to have it write both the IDE transcript and the JS console. Needs to be worked out.
To your question. Library is an informal term. Any Newspeak module definition (i.e., a top level class) is a library, and to use, it you call its class methods, most likely to instantiate it.
If you want to deploy a module, well, you need to use it via an app (i.e, define something with #packageUsing: and #main:args:), directly or indirectly.
To view this discussion on the web visit https://groups.google.com/d/msgid/newspeaklanguage/CAOq-cNwk%2BoXtzc4vKVS4HDMc2GG%2BkUh2rAuSLu3azaPjCFh-aA%40mail.gmail.com.
So how do those "live documents" work. The texts with the embedded cells running snippets of code?
Presumably there's a way to embed running code in a document and have the result of that injected into the document?