objeck / objeck-lang

Objeck is a modern object-oriented programming language with functional features tailored for machine learning. It emphasizes expression, simplicity, portability, and scalability. The programming environment consists of a compiler, virtual machine, REPL shell, and command line debugger with IDE plugins.
https://objeck.org
Other
157 stars 11 forks source link

Call Objeck methods from C++ #355

Closed ghost closed 1 year ago

ghost commented 1 year ago

Discussed in https://github.com/objeck/objeck-lang/discussions/131

Originally posted by **ghost** February 8, 2023 Is it possible? It's possible to call Java from C++ using JNI: https://www.baeldung.com/jni#2-using-objects-and-calling-java-methods-from-native-code

Note: This is about calling methods written in Objeck from C++.

objeck commented 1 year ago

Not possible, the VM runs programs not functions with programs.

ghost commented 1 year ago

Not possible, the VM runs programs not functions with programs.

Why it's possible with other languages that also run on a VM? Objeck's architecture is anything different?

Take for example: Mozilla Rhino and Java Nashorn, V8 (otherwise there would be no NodeJS and Deno), Python,... Just create a new interpreter object and you could evaluate anything you want. What make Objeck so different?

objeck commented 1 year ago

Again, Objeck executes programs, not functions. It may be possible to execute a function if there is an entry point, i.e., like Main. Please, understand I do not have time to explore all your suggestions.

objeck commented 1 year ago

It seems interesting. However, porting seems timely.