Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'll try to roughly outline how it works in Newspeak. </p> <p>Any code you write has to be in a <em>module</em>. Module is a kind of class, since in Newspeak classes can contain other classes, a Module is essentially a top-level class - one which is not contained in another class. What is special about Newspeak is that <strong>you cannot refer to anything outside of your module</strong>. </p> <p>So how do you print to console in Newspeak? Printing belongs to Console class (a.k.a. Smalltalk's Transcript) which is part of the Platform module. To be able to print to console, your module would take a Platform constructor parameter, get console from the platform, store the console in a slot, and then use it to print. </p> <p>Basically it's like dependency injection enforced on the language level. The language IDE and runtime help you package and bootstrap your program, but if you are looking for more details - go to <a href="http://gbracha.blogspot.com/">Gilad Bracha's blog</a>, see <a href="http://gbracha.blogspot.com/2008/12/living-without-global-namespaces.html">this post</a> for example, or check out <a href="http://bracha.org/newspeak-modules.pdf">Newspeak Modules paper</a>. </p> <p>P.S. Newspeak is neither impractical nor unusable, for the record - it was used in the industrial environment, and now has a small (but growing) open-source community around it. Newspeak is very new and evolving, sure, but from personal experience - it is quite easy and fun to write programs in.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload