adder icon indicating copy to clipboard operation
adder copied to clipboard

Accessing built-in functionality with better syntax.

Open hhhhhhhhhn opened this issue 4 years ago • 2 comments

I think this project is amazing and probably the best there is out there in terms of client-side sandboxes, but I think there are a couple of things holding it back.

One of the main problems I've noticed is the lack of shorthand list/dictionary initialization and access, which could make the creation and access much easier.

old_list = list(0,1,2)
old_dict = dict()
old_dict.set("a", 0)
old_dict.set("b", 1)
old_dict.set("c", 2)

print(old_list.at(1))
print(old_dict.get("b"))

# Would look much better like

new_list = [0,1,2]
new_dict = {"a":0, "b": 1, "c":2}

print(new_list[1])
print(new_dict["b"])

But the real dealbreaker for me was that there is no built-in way of creating classes/modules. Something like the python class initializer would be very helpful to organize complex code.

Are there any plans for improving the syntax? Thanks in advance

hhhhhhhhhn avatar Apr 19 '20 19:04 hhhhhhhhhn

Hi @oekshido, I agree with your statement but I'm no longer actively working on this project. If you want to pick it up and provide PRs, I'll be happy to test and merge.

With that said, note that today there's a very mature Python-over-JavaScript library https://github.com/skulpt/skulpt (not 100% sure about its security features though), and with the new WebAssemblies (https://en.wikipedia.org/wiki/WebAssembly) you can theoretically use any language (or at least should be able to in the near future) so maybe Lua can be a better choice. Not sure just how much WebAssembly is mature because I haven't used it, but here's C# for example:

https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor

Just giving general ideas if you can't afford the time to improve Adder and look for alternatives :)

RonenNess avatar Apr 20 '20 06:04 RonenNess

Thank you, and I will look forward to your suggestions :)

hhhhhhhhhn avatar Apr 20 '20 15:04 hhhhhhhhhn