Ni - a strange little language

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Ni - a strange little language

Göran Krampe
Hi guys!

Just wanted to give a pointer to a little language I am implementing:

http://goran.krampe.se/2015/09/16/ni-a-strange-little-language/

Is it a new Smalltalk-80? No.
Is it Smalltalkish? Yes. But still quite different. :)

The article tries to introduce some of the funkier aspects of Ni. In
essence Ni is a homoiconic dynamically typed garbage collected 100% live
language similar to Lisp/Rebol/Forth in its simplicity.

But it also has Smalltalk keyword syntax, Smalltalk non local return,
blocks-as-closures as in Smalltalk and well, perhaps a few more odds and
ends similar to Smalltalk.

And one of the next steps is adding objects to it. This will be based on
a model of cloning and delegation and an object, so a bit closer to Self
there.

Why would you want to look at it? Because it breaks (or will break) a
few barriers that most Smalltalks still suffer from... easy integration
with C/C++, multithreading, embeddability and so on.

Hope you find it interesting!

regards, Göran

PS. Fast? Nope. I mean, its decent for an AST interpreter but I haven't
spent time optimizing it yet - it uses dynamically allocated things and
methods (dynamic dispatch) quite heavily today.

Reply | Threaded
Open this post in threaded view
|

Re: Ni - a strange little language

Peter Crowther-2
Congratulations, you made the main headline on The Register as I type this.

http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/

Cheers,

- Peter

On 16 September 2015 at 12:58, Göran Krampe <[hidden email]> wrote:
Hi guys!

Just wanted to give a pointer to a little language I am implementing:

http://goran.krampe.se/2015/09/16/ni-a-strange-little-language/

Is it a new Smalltalk-80? No.
Is it Smalltalkish? Yes. But still quite different. :)

The article tries to introduce some of the funkier aspects of Ni. In essence Ni is a homoiconic dynamically typed garbage collected 100% live language similar to Lisp/Rebol/Forth in its simplicity.

But it also has Smalltalk keyword syntax, Smalltalk non local return, blocks-as-closures as in Smalltalk and well, perhaps a few more odds and ends similar to Smalltalk.

And one of the next steps is adding objects to it. This will be based on a model of cloning and delegation and an object, so a bit closer to Self there.

Why would you want to look at it? Because it breaks (or will break) a few barriers that most Smalltalks still suffer from... easy integration with C/C++, multithreading, embeddability and so on.

Hope you find it interesting!

regards, Göran

PS. Fast? Nope. I mean, its decent for an AST interpreter but I haven't spent time optimizing it yet - it uses dynamically allocated things and methods (dynamic dispatch) quite heavily today.




Reply | Threaded
Open this post in threaded view
|

Re: Ni - a strange little language

Hannes Hirzel
Some of the comments on theregister might need some attention.

Here some of my questions:

a) I wonder how Ni is related to Nim  http://nim-lang.org/?

b) The Ni article mentinons OrderedCollections and Dictionaries ---
where can I find an example which demonstrates how they are used?

c) Is there a JSON reader and writer for OrderedCollections and Dictionaries?

d) What kind of string operations does it support?

e) The Ni to Nim translator is fairly short.

     e1) How would a Ni to Smalltalk translator look like? (LOC estimate)
     e2) Or a Smalltalk to Ni translator (LOC estimate)?


f) Could Ni be an alternative for plug-in writing of Smalltalk?

g) What about speed of compiled Ni / Nim code?

--Hannes

On 9/18/15, Peter Crowther <[hidden email]> wrote:

> Congratulations, you made the main headline on The Register as I type this.
>
> http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/
>
> Cheers,
>
> - Peter
>
> On 16 September 2015 at 12:58, Göran Krampe <[hidden email]> wrote:
>
>> Hi guys!
>>
>> Just wanted to give a pointer to a little language I am implementing:
>>
>> http://goran.krampe.se/2015/09/16/ni-a-strange-little-language/
>>
>> Is it a new Smalltalk-80? No.
>> Is it Smalltalkish? Yes. But still quite different. :)
>>
>> The article tries to introduce some of the funkier aspects of Ni. In
>> essence Ni is a homoiconic dynamically typed garbage collected 100% live
>> language similar to Lisp/Rebol/Forth in its simplicity.
>>
>> But it also has Smalltalk keyword syntax, Smalltalk non local return,
>> blocks-as-closures as in Smalltalk and well, perhaps a few more odds and
>> ends similar to Smalltalk.
>>
>> And one of the next steps is adding objects to it. This will be based on
>> a
>> model of cloning and delegation and an object, so a bit closer to Self
>> there.
>>
>> Why would you want to look at it? Because it breaks (or will break) a few
>> barriers that most Smalltalks still suffer from... easy integration with
>> C/C++, multithreading, embeddability and so on.
>>
>> Hope you find it interesting!
>>
>> regards, Göran
>>
>> PS. Fast? Nope. I mean, its decent for an AST interpreter but I haven't
>> spent time optimizing it yet - it uses dynamically allocated things and
>> methods (dynamic dispatch) quite heavily today.
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Ni - a strange little language

Göran Krampe
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


Reply | Threaded
Open this post in threaded view
|

Re: Ni - a strange little language

Martin Bähr
In reply to this post by Peter Crowther-2
Excerpts from Peter Crowther's message of 2015-09-18 11:47:52 +0200:
> Congratulations, you made the main headline on The Register as I type this.
>
> http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/

i was going to suggest "the programmers who say ni" and ask if they would bring
us the holy grail of software development...

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      pike.lysator.liu.se    caudium.net     societyserver.org
secretary                                                      beijinglug.org
mentor                                                           fossasia.org
foresight developer  foresightlinux.org                            realss.com
unix sysadmin
Martin Bähr          working in china        http://societyserver.org/mbaehr/

Reply | Threaded
Open this post in threaded view
|

Re: Ni - a strange little language

Göran Krampe
In reply to this post by Peter Crowther-2
Hey!

On 09/18/2015 11:47 AM, Peter Crowther wrote:
> Congratulations, you made the main headline on The Register as I type this.
>
> http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/

Hehe, but that article was.... not an article. Could almost have been
written by a robot - perhaps it was.

regards, Göran