[squeak-dev] Ni - a strange little language
Göran Krampe
goran at krampe.se
Fri Sep 18 11:51:00 UTC 2015
Hi!
On 09/18/2015 01:19 PM, H. Hirzel wrote:
> Some of the comments on theregister might need some attention.
Ahh... yeah. I will try to post some replies later today. I need to
register there first I guess.
> Here some of my questions:
>
> a) I wonder how Ni is related to Nim http://nim-lang.org/?
1. Its implemented in Nim.
2. Its meant to mix with Nim, like using Nim libraries easily etc.
3. It reuses as much as possible of Nim mechanisms, like its GC etc.
> b) The Ni article mentinons OrderedCollections and Dictionaries ---
> where can I find an example which demonstrates how they are used?
I mentioned those classes as a reference to Smalltalkers. Ni only has
blocks so far (OrderedCollection) but will also have Dictionaries in the
form of "objects" like in Javascript kinda.
Ni is meant to "keep small" and not fatten up like Smalltalk has done
with about 80 different collections. ;)
> c) Is there a JSON reader and writer for OrderedCollections and Dictionaries?
Hehe, ehm, no? :) But yeah, easy for me to tap into Nim's libraries and
add that.
> d) What kind of string operations does it support?
Not much at all yet, its still a toy. But I will expose the Nim
libraries in Ni so there will be no shortage of functionality. The hard
part is to select a reasonable complete subset that is small.
> e) The Ni to Nim translator is fairly short.
Its not a translator, its an interpreter. Ni is never translated to Nim.
Although one can entertain such thoughts in the future, since Nim has
very powerful code generation mechanisms.
> e1) How would a Ni to Smalltalk translator look like? (LOC estimate)
No idea, its hard to... see the usefulness I think.
> e2) Or a Smalltalk to Ni translator (LOC estimate)?
This is more interesting, since I think Ni can be made to look/feel like
Smalltalk quite easily. If one would implement a bit of base libraries
using the same method names etc, it could map quite easily.
But I don't personally intend to make a "Smalltalk duplicate" - that's
boring. I borrow what I like, but renew if I think there is better ways.
Rebol has lots of interesting techniques for example.
A silly trivial example, in Ni I can use "?" in method names. So I want
to use that as a convention for methods that return booleans. Like the
"end?" call in the code sample.
> f) Could Ni be an alternative for plug-in writing of Smalltalk?
No, but Nim already is. The SqueakNim tool already autogenerates FFI
stubs for Nim, so very easy to use. We use Nim extensively at 3DICC for
this.
> g) What about speed of compiled Ni / Nim code?
Nim code is basically same speed as C/C++. So very fast. It compiles via
GCC by generating very efficient C/C++ code.
Ni is a plain interpreter. I can probably reach Python speeds with it,
but I don't intend to go further. For the moment its completely
unoptimized and falls short of that, but on the other hand I can very
easily tap into Nim for heavy lifting. Much easier than in Smalltalk.
> --Hannes
regards, Göran
More information about the Squeak-dev
mailing list
|