adamsol / pyxell Goto Github PK
View Code? Open in Web Editor NEWMulti-paradigm programming language compiled to C++, written in Python.
License: MIT License
Multi-paradigm programming language compiled to C++, written in Python.
License: MIT License
C break and continue have limited utility because in a double loop, you cannot break out of the outer loop. I had these in my language too originally, but replaced them with labelled break and continue. In my language, the label is mandatory if you want to break or continue (or redo) but for compatibility you might allow the default to be the current loop. I think this is not a good idea though, because the absence of a label ensures the loop can only be either normally exited, or exited by a premature function return (which is a problem, it would be better if the assurance was absolute but I don't know how to do that in an imperative language with a return statement).
I love the language design so far, especially with type annotations fixed to be in name: Type
form.
But one thing, that I could not find in the docs nor in todo list, is the decorators. Do you have plans to add support for decorators?
"Inside the method body, you can call the corresponding method of the parent class using super keyword."
What happens if your base and derived class have methods f and g, and in the definition of f in the derived class you want to call the base class method g? AFAIKS there is no way to do this. In fact i would suggest outlawing calling base class methods which have been overridden altogether. The only case where you might need to do this are in constructors.
Do you have plans to add support for multiple dispatch, like in Julia language?
Hello, I've skimmed Pyxell's documentation but didn't notice anything about an ffi, can Pyxell call C or C++? I assume that it has an easy cpp ffi since it compiles to c++.
The docs say "Tuples are mutable, but they have value semantics, so they are hashable and can be passed around as if they were immutable."
No. Variables may be mutable, including variables of a tuple type. Modifying a component of a variable of a tuple type is equivalent to constructing a new tuple of the same type from the old one with a different value for that component, and assigning it. I think this is what you meant, it just reads wrong.
I hope you offer a dark on light theme since I find the current light on dark practically unreadable. Which is a pity beause Pyxell looks interesting.
I think, in Python lambda functions looks ugly, by design, in order to discourage use of lambdas if possible (I might be wrong).
Consider lambdas similar to ones used by Julia, for example, this Pyxel code:
double = lambda x: x * 2
Could look like this:
double(x) = x * 2
Or:
double(x: Rat): Rat = x * 2
Multi statement lambdas, could look like this:
count(n) def
for i in n..0 by -1 do
print i
how to read a file content?
thank you very much
Hi,
I tried the closure example:
// closure.px
func f() def
x = 0
func g() def
x += 1
print x
g()
print x
f()
func f() def
x = 0
func g() def
x += 1
print x
g()
print x
python pyxell.py closure.px
then gives non-expected cpp file contents below (with exe result correct!)
What goes wrong?
Exe compile works on company laptop after Python install via Windows app.
Not working at home with pre-existing Python if that can make a difference.
Error message is dll entry point for xxx_throw_bad_array_new_lengthv not found in dll xxx\closure.exe
File sizes:
closure.px 109
closure.cpp: 588
closure.exe: 549864
`/*
Generated by Pyxell 0.14.0.
https://github.com/adamsol/Pyxell
*/
Float v1;
Float v2;
const String v3 = make_string("inf"s);
Float v5;
const String v9 = make_string("\n"s);
Void f6();
Void f6() {
Int v10;
v10 = 0LL;
std::function<Void()> f11 = =, &f11 mutable -> Void {
v10 = (v10 + 1LL);
write(toString(v10));
write(v9);
};
f11();
write(toString(v10));
write(v9);
}
int main() {
v1 = 3.141592653589793;
v2 = 2.718281828459045;
Float v4 = [&](auto&& ...args) {
return toFloat(v3, args...);
}();
v5 = v4;
f6();
return 0;
}`
Package it with a setup.py and everything so we can install it on PyPi
I thought you were against this:
Float x
Why not use he universally accepted correct way to do this, namely
var x : Float
You can leave out the var
if you want, but you HAVE to write the separator. You could use the reverse order too, but the separator is mandatory. There's a good example of why your syntax is untenable in your own examples:
A -> B f
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.