Live data from Hacker News

OneLang – A tool to help writing code in multiple languages at the same time

ide.onelang.io

61–69 of 69 posts

Re: OneLang – A tool to help writing code in multiple languages at the same time

#61

Earlier quoted context omitted.

That would fail to compile in TypeScript as well, and you should get a red squiggly or other syntax error indication in most IDEs. Math.random() takes no parameters. From lib.d.ts: interface Math { // ... /** Returns a pseudorandom number between 0 and 1. */ random(): number; // ... }

Actually `Math.random()` will fail too. I am probably not emphasizing this enough, but One is currently a "toolkit" for converting syntax between languages. `Math.random()` is ~a standard library function. One has limited knowledge about language's StdLibs. But you can make `Math.random` (or any method) work without modifying the compiler, only by adding the appropriate implementation and StdLib definitions to approp…

Oh, ok I think I understand it better. That sounds like a really useful tool. Actually in a project I was in last year we really hesitated between writing a lib in C++, C# or Java (Native android, Unity3D lib, Android java) and had good arguments for either but no budget for maintaining all three.

I would have seriously considered your option at the time.

I have no time to dive into this now but I'll bookmark it and come to wave at your gitter.

Is it realistic to contribute to it with knowledge of C++/C#/Java/Python but a pretty poor grasp of JS?

Re: OneLang – A tool to help writing code in multiple languages at the same time

#63

Opening the site on my 3GB RAM laptop froze it - could you please not pile web frameworks atop one another? Being able to translate between languages in all cases is intrinsically impossible because of the halting problem; that this works is a testament to how restrictive and bland the Von Neumann language paradigm is, seeing as these languages aren't terribly different and all have ridiculously long specs. The close…

The halting problem has nothing to say against translating between languages. A non-terminating program will simply be translated into another non-terminating program. In fact, Turing completeness is all about the fact that a program in any language can be translated into an equivalent program in another.

Some languages can't be parsed without solving the halting problem, but even in such cases, you can simply bundle it with an interpreter in the target language. And the subset of programs humans are actually likely to write should be much saner.

Re: OneLang – A tool to help writing code in multiple languages at the same time

#64
post #60

it does not work on my first test: My program is i=1 and the Java program it produces is: class Program { public static void main(String[] args) throws Exception { i = 1; } } which is wrong because "i" must be defined in java as in "int i;"

Try writing "let i = 1". I think the assumption is that if you use undeclared identifiers, you'll provide them to the generated code in some other way.

Re: OneLang – A tool to help writing code in multiple languages at the same time

#66

Earlier quoted context omitted.

2008 to 2018 is 10 years last I checked.

Alright, my aim is very off. But even 5 years would be enough don't you think ?

I think it’s certainly time to have switched. All important libraries have migrated and Python 3.6’s dictionary is faster and more memory-efficient.

Python 2 is dead. Long live Python 3.

Re: OneLang – A tool to help writing code in multiple languages at the same time

#67
post #43

It seems like a really strange choice for the "source" language to be JS - a language without any real static typing capability (even with TS). The most limited & basic kinds of static analysis are technically possible, but why not just start with an entirely static language and translate from that to dynamic languages? Would seem much simpler...

> It seems like a really strange choice for the "source" language to be JS I can't speak for the author, but I can think of several reasons I might choose JS: 1. Almost everyone working on the web knows it, so not knowing the source language won't be a roadblock right away. 2. Precisely because of the issues you mentioned, JS is a lot easier to translate with perfect (or close to perfect) fidelity. If the source were…

> 2. Precisely because of the issues you mentioned, JS is a lot easier to translate with perfect (or close to perfect) fidelity. If the source were something like Haskell, every translation would be very lossy.

On the contrary, the fewer restrictions a language has, the more difficult it becomes to translate it into languages with stricter requirements. If this were built on JavaScript and not TypeScript, it couldn't even generate the correct type annotations for the other languages that require them. I doubt that this project is going to grow a Haskell backend anytime soon.

Re: OneLang – A tool to help writing code in multiple languages at the same time

#68
post #4

If anybody is looking for something stable for years, have a look at haxe [1] [1] https://haxe.org

Can I ask how Haxe is connected to Flash? For some reason, the first time I looked at Haxe I got the impression that Haxe is an open-source Flash / Flash successor. (Mostly, I think, because Flash keeps getting mentioned with projects associated with Haxe, like OpenFL and Flambe, and several times in the Haxe Wikipedia article). Clearly Haxe isn't "just" an open Flash, but how is Haxe related to Flash?

Haxe is a programming language and should be compared to as3. It is much more powerful and can compile to 12 targets including JavaScript,php, c++, and as3. OpenFL is a cross-plateform port of the flash API in Haxe. All this flash stuff are just a part of an amazing technology.

Re: OneLang – A tool to help writing code in multiple languages at the same time

#69
post #59

Earlier quoted context omitted.

indeed, I like your project. Negativity of the community can be discouraging. I stopped a project of mine because of a combination of the negativity and from the reality of having to hiring and train people to use my language. Here is _some_ of the negativity I got: https://www.reddit.com/r/programming/comments/6ori0/kira_is_... What excites me about your project is the possibility to write core math or business logi…

/r/programming is one of the most pedantic forum I have ever seen but I also see it as a place where programmers flee and shelter from the non-technical bullshit and vent a bit. If you submit anything there, be prepared for harsh criticism. There is some real value in there, but encouragement and cheerings won't come from there.

In other words, r/Programming is like the r/RoastMe of programming. Take everything with several grains of of salt.
Post reply on HN