ELENA-LANG / elena-lang

ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
https://elena-lang.github.io/
MIT License
233 stars 24 forks source link

elt crash #553

Closed Ilir-Liburn closed 1 year ago

Ilir-Liburn commented 1 year ago

Hello,

while running elt, I entered exit command (my habit) causing crash, e.g. starting debugger in postmortem mode.

arakov commented 1 year ago

Thanks. I will check

arakov commented 1 year ago

The bug is fixed in the upcoming version - 6.0.4.

arakov commented 1 year ago

Closing the ticket. @Ilir-Liburn, please, fill free to reopen it if after the release (somewhen around start of July) if the problem still exists for you

Ilir-Liburn commented 1 year ago

Hello,

what is equivalent to elt (Virtual machine console) in upcoming version? Can compiled and linked code use eval (is it possible outside the VM)?

arakov commented 1 year ago

Hi, it will be called - elt-cli.exe

Yes, stand-alone executable can use the scripting as well. See for example this tutorial - https://github.com/ELENA-LANG/tutorials/tree/master/ExpressionTree2 . Of course all used classes and messages should be declared.

The simplest code can look like this:

import extensions;
import extensions'scripting;

public program()
{
    var t := new ScriptEngine()
            .loadScript("[[ #grammar build ]]")
            .loadPath("~\scripts\grammar60.es")
            .loadPath("~\scripts\tscript60.es");

    var o := t.buildScript("public program() { console.writeLine(""Hello World"") }");

    o.eval();
}

Of course, there are things to work on. For example the extensions are not yet supported, I'm working on it. Currently it is done only for windows x86. With time I will migrate it to all remaining platforms

ELENA will support the user-defined grammar for source files as well.

Ilir-Liburn commented 1 year ago

Thanks,

first one is about user defined scripts, second is about executing Elena code, right? If yes, can eval create classes/methods, functions, etc?

arakov commented 1 year ago

User-defined grammar will generate the normal codes with classes & symbols and be executed as a normal code.

Evaluation of the code in run-time will be able to create the classes as well (in ELENA, a function is a special case of a class). Though it is not normal class. It is a mix-in. You can use it but you cannot inherit it (at least currently, maybe some form of inheriting can be implemented). But for the most of the cases, it will be a normal class. You can call a method, pass it further and so on. I'm not yet 100% finish with it, it is possible to create a singleton. I will add support for classes which can be created later. Another limitation, that you cannot inherit from another class. Though I think I will be able to support the interfaces.