Comments (1)
That would be actually easy to implement. The problem with most kinds of compilers / transpilers is that they can't see the whole picture and they can't assume that there is no external dependency that e.g. uses I/O.
Pseudo-Python does whole program analysis and it supports a limited subset of external dependencies(currently a subset of the standard library) for which it can maintain all kind of metadata.
It would be trivial to add "uses IO" and "pure"(as in no other side effects) markers to the current type signatures and to add a Pseudo middleware that infers them for user-defined methods / functions.
The other issue with converting to Haskell / Clojure is local variable changes. Pseudo AST semantics are similar to those of a classic imperative language in order to support easily Python, Ruby, JS, C# transpilers as a target. That means that often logic in a function can be encoded with .push
/ []=
/ sort in place
/ a lot of temp variables. It's easy to convert that to nested let/letrec
in Clojure or let
in Haskell, however it would be probably very ugly. It would be nice to add a middleware that turns that kind of heavy-imperative style of code to more functional style so the actual generated code would be more idiomatic.
from pseudo.
Related Issues (18)
- Error in generating boolean literal in ruby HOT 1
- Error in converting python list comprehension HOT 3
- Enhancement Suggestion : PHP HOT 3
- Parenthesise operators if necessary HOT 1
- Ruby – generate attr_accessor for ivars HOT 1
- Add support to convert/parse go code to Pseudo AST? HOT 2
- "[Every language other than C#] doesn't have a List#concat method" HOT 4
- Standard library
- JSTranslator doesn't have a String#include? method HOT 1
- can't change the type of variable string in global scope from String to List[String] HOT 1
- Why has dev stalled? HOT 19
- Proposing a PR to fix a few small typos
- Documentation
- Starargs sugar for Python and Ruby
- Convert tuples to classes in C# HOT 1
- Dead link in README HOT 1
- Application idea: css-layout HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pseudo.