isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Library support and import #261

Open Emnolope opened 4 years ago

Emnolope commented 4 years ago

This is a feature request. It'd be cool if Pyth supported importing libraries, albeit abbreviated ones. This would allow for some ridiculously complicated code at very low character lengths. There are already standard abbreviations such as numpy = np, module=mdl, pandas=pd .

jakobkogler commented 4 years ago

I think it would be quite difficult to integrate such libraries.

First of, all the abbreviations are already valid Pyth codes. E.g. np prints a value and then negates it. So you would need some different tokens already. And then you need all kinds of other syntax. How do you create a numpy array? Certainly not with np.array(), since Pyth uses Prefix notation. How do you manipulate with these objects. You would need to overload all kinds of operators, like +, and others, and introduce new ones for the actual useful new functions that the libraries provide.

I agree, it would be cool, however not very realistic. Also I'm not sure if designing and implementing such a system would bring much improvements to this language.

But if you have some concrete plans, I would like to hear them.

Btw, @isaacg1 hasn't responded to any messages since April/Mai (?). So I doubt that anything will happen, unless you (or somebody else) makes a complete fork of Pyth.