A new programming language to write complex apps with on the SAFE Network

Hi, I’m really interested in programming language design and have been experimenting with one of my own that I have been writing the interpreter for in Rust.

I was thinking about using the SAFE network as a platform for this new language (Zia).

Zia integrates source code and database allowing programs to evolve throughout their production lifetime and be self-reflective. Minimal hard-coded syntax rules allow almost all syntax to be reprogrammable and complex programs written compactly.

Zia can be to Python like Python is to C, allowing much more human-readable code, expressive power, faster software development and more complex applications.

Developers could write their Zia programs to the SAFE Network and manage read/write acess for other applications without ever having to worry about hosting it on a server. Hopefully this will attract more developers to the SAFE Network :smiley:

It’s still very early days but I am looking for some thoughts on this so I can steer the development in the right direction.

Cheers

17 Likes

Cool idea.
I have no experience with programming language design, but do a lot of coding, all day long and have coded against the SAFENetwork API. So a few questions emerge:

Is it possible that you could delve into more details of this part?
I’m trying to grasp what it would look like and how I would work with it.

9 Likes

Hi oetyng,

Let me explain what you quoted.

First sentence: instead of running a compiled executable or interpreting scripting code (text), the Zia interpreter connects to a database encoding the equivalent of source code and runs the expressions you type in.
Second sentence: the source code is encoded into the database in a way that allows easy refactoring of any syntax, defining operator precedence and defining more complex syntax rules on the fly.

3 Likes

Have you looked much at JavaScript? What you describe sounds similar in both those respects.

If you have looked at it, I think it would help clarify your idea to point out the similarities and differences with JavaScript.

1 Like

No, you can’t define your own syntax in js. monkey patching isn’t defining your own syntax (in js, in a more “textual” language, eg Ruby, or a langs which allow operator overloading it can be).

All the “Code” comes from the user (gets typed in by him/stdin). So it’s some thing like rbi?

Sounds like Rubys “DSL” approach.

At the same time that’s the reason why i dislike ruby. One of it’s idioms is to add every new functionality by monkey patching so you end up inconsistently (coz some libs do that some don’t) having functionality smashed into the stdlib (ruby on rails has >250 methods on the String class) + duck typing (which caused bugs in combination with Ruby on Rail’s helper methods for me); and rather like Rusts static typed and the selectable (you need to use it first) trait approach.

What about efficiency? You can compile rust AOT to wasm which can be run very efficiently. But making it a script language would degrade the performance, js engines do black magic just to get that js executed fast.

1 Like

This is really cool! Following this thread with interest :wink:

Defining syntax in Zia can be done by effectively monkey patching but then saving the patches to the database containing the source code.

I’m writing the Zia interpreter which can be interactive like the Interactive Ruby Shell or accept stdin from a file or another program.

Zia should be a general purpose programming language.

Efficiency will be an issue without any compiler functionality so that’s something I’ll need to design into the language.

1 Like

I’ll give you an example comparison.

JavaScript

    function factorial(n) {
        if (n == 1) {
            return 1;
        } else {
            return n * factorial(n-1);
        }
    }
    factorial(10);

Zia

    _x ! -> _x * (_x - 1) !
    1 !  -> 1
    10 ! ->
2 Likes

where’s the recursion (factorial(n-1)) happening in your zia code?

is this online on github, gitlabs or $code_hosting_site?

If a symbol begins with an underscore, any other symbol can be substituted for it.
When Zia is trying to reduce (using the symbol) the expression 10 !, it tries to look for explicit reduction rule for 10 !, if not, a more general rule like for _x !.

2 Likes

Isn’t it happening in there? the _x calls itself? I’m just a dummy, but that’s what I’m guessing.

Sorry, I made a typo at the most crucial point! I’ve edited it now

4 Likes

Is this anything to do with Category Theory? I’m seeing some correspondence to a discussion about that wrt RDF.

I’m not sure, I haven’t studied Category Theory in any real depth, but briefing reading about it I’m struggling to see a clear correspondence. Which discussion are you refering to?

Actually, I might get what you’re saying. corresponds to a link and the expressions either side are objects in Category Theory

Hi Charles,

I think the idea is great. Can you give us a link where we can find more information? (e.g. Github…)

Thank you.

I’m probably off here, but this comment is what looked similar:

https://gitter.im/solid/chat?at=5b83f6c18d59fb7567e18a4f

Hi arkaitz,

While I think it would be nice for the Zia interpreter to be open-source, I am worried about how its development will be funded/incentivised.

When users pay safecoin for a PUT request for uploading their programs on the SAFE Network, they could pay a small commission to the developers of Zia. I’ve seen a similar idea discussed on the forum for funding online multiplayer games on the SAFE Network.

If the interpreter was open-source then someone could just copy and modify it so commission doesn’t need to be paid and reduce the incentive to develop and maintain the language.

Let me know your thoughts on this.

Are you referring to PtP (Pay the Producer) and/or PtD (pay the developer) ‘features’ of Safe Network?

More knowledgeable people may roll their eyes but this sounds like what Wolfram was talking about, if I have this right, when saying he was looking for something like a universal language for AI. As if in Wolfram Language he was looking beyond math and language. Its like he wanted to brush aside details so that more minds could access tools with roots in computation. Said this was always his aim in retrospect.

Said stuff like: you think we’re going to communicate with AI in English- is there a better way? I liked it because as an outsider it was like asking what if the whole approach idea of programming languages was wrong or obsolete.
Is English even close to an optimum for human communication? Some said no with Interlingua and Esperanto. In that lecture if memory serves it was if he was saying a lot of what has to happen with AI comes down to communucation.

2 Likes