News for hackers. Stuff that matters.
Re:OneLang – A tool to help writing code in multiple languag... by sametmax on Monday February 19, 2018 @04:01PM (#16415715)
It's fun but breaks very quickly. One simple line such as "console.log(Math.random(10));" will fail.

Amusing anyhow.

Also: please make it python 3. It's been 13 years...

Re:OneLang – A tool to help writing code in multiple languag... by Stratoscope on Monday February 19, 2018 @04:06PM (#16415747)
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;

      // ...
  }
Re:OneLang – A tool to help writing code in multiple languag... by koczkatamas on Monday February 19, 2018 @04:28PM (#16415885)
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 appropriate files. (Even now only using the WebIDE).

The plan is to make One plugin-able and create a "package" manager infrastructure, so anybody can implement `Math.random()` or any other methods, publish it and then you can just download that package.

Implementing every language's StdLib is not a one-man job, so I've always considered this out-of-scope.

Sorry if any published information regarding this was misleading.

Re:OneLang – A tool to help writing code in multiple languag... by Iv on Tuesday February 20, 2018 @05:14AM (#16419171)
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 languag... by stochastic_monk on Monday February 19, 2018 @04:16PM (#16415816)
2008 to 2018 is 10 years last I checked.
Re:OneLang – A tool to help writing code in multiple languag... by TomK32 on Monday February 19, 2018 @04:30PM (#16415906)
December 2008, not even 10 yrs yet.
Re:OneLang – A tool to help writing code in multiple languag... by sametmax on Tuesday February 20, 2018 @04:15AM (#16418905)
Alright, my aim is very off. But even 5 years would be enough don't you think ?
Re:OneLang – A tool to help writing code in multiple languag... by stochastic_monk on Tuesday February 20, 2018 @08:41AM (#16420188)
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.