On Monday, September 2, 2013 at 6:54:17 PM UTC, Stefan Karpinski wrote:
>
> This won't work at this point for the same reasons that we can't yet 
> generate binaries – we use the LLVM JIT incrementally rather than compiling 
> a large, complete chunk of LLVM code. If it is/were possible to use LLVM to 
> compile itself as JavaScript, then maybe you could do it. Even then, you'd 
> also have to get all of the other external libraries 
> <https://github.com/JuliaLang/julia#required-build-tools-and-external-libraries>
>  working 
> in JavaScript.
>

Do you *have to* "get all of the other external libraries working"? See 
point B.

A,
I would like to see Julia work on Android, iOS, Chrome OS, maybe Firefox OS 
and Windows Phone. Supporting JavaScript/the web is one way. I see there is 
progress to get ARM to work, Android (and iOS) support (without MIPS..) 
might be not far away then, and JavaScript (JS) not needed as much.. Native 
support seems preferred, as then B. is not an issue..

What is the draw for people to get JavaScript support working? Firefox OS 
isn't really a priority for me, or would make or break Julia.. It however 
allows nothing else than JavaScript. Chrome OS, isn't as strict, I haven't 
looked into Chrome web apps much but think it kind of allows C (also 
assembly?) code (and latest Chromebook Pixel C is based on Android not 
Chrome OS, so maybe it is on the way out..).


I looked into the issues for getting other languages to work in a browser 
(is Scala the best supported language to learn from? Except for, maybe, the 
made to compile to JS languages, such as Dart), to learn from others.

I worried more about getting all JavaScript libraries (than possibly 
Julia's own..) supported from Julia, but since Scala-js has the interop 
(such as for Angualar) then maybe its not hard to do. There are however 
semantic differences for the Scala code (some I had overlooked, its not 
just the Integer issue.. would these be a problem?):

http://www.scala-js.org/doc/semantics.html
"Scala.js underspecifies the behavior of Floats by default. Any Float value 
can be stored as a Double instead, and any operation on Floats can be 
computed with double precision. The choice of whether or not to behave as 
such, when and where, is left to the implementation."

I was a little surprised by this, I thought 1.4 wasn't accurate for double 
either:
"1.4 matches Double only if strict-floats are enabled, otherwise Float and 
Double (unlike 1.5, the value 1.4 cannot be represented in a strict 32-bit 
Float)"

This seems what we could do for Julia (and probably best):
"JavaScript regular expressions are slightly different from Java regular 
expressions. The support for regular expressions in Scala.js is implemented 
on top of JavaScript regexes."

"scala.Symbol is supported, but is a potential source of memory leaks in 
applications that make heavy use of symbols."



I know about http://escher-jl.org/

I assume that doesn't mean it generates JavaScript code from arbitrary 
Julia code, just enough to make web pages/apps, but in what cases is more 
really needed? As I understand, Escher tries not to reuse, say Angular, or 
allow you to. The original announcement says "You don't need to learn or 
write HTML or CSS or JavaScript". Maybe I misremember, but at some point I 
read/interpreted Escher to say it generates JS for you, at least it allows 
for "rich UI".


B.
Of the external libraries (that are not optional - yet..), what is the 
minimum you need to support? My guess:

LLVM (3.3) — compiler infrastructure. (3.4 not supported; 3.5+ mostly 
supported, with caveats)
already not a problem.

FemtoLisp — packaged with Julia source, and used to implement the compiler 
front-end.
or some substitute (mentioned in the thread).

libuv — portable, high-performance event-based I/O library
Is this only for green-threading? Can you skip if you want just basic 
(single-threaded non-parallel) Julia support.. 

OpenLibm — portable libm library containing elementary math functions.
Skip or just easy to support? I guess this would be the bare minimum to get 
floats?

DSFMT — fast Mersenne Twister pseudorandom number generator library.
Skip - or just substitute with what JavaScript has?

OpenBLAS — fast, open, and maintained basic linear algebra subprograms 
(BLAS) library, based on Kazushige Goto's famous GotoBLAS.
Since this is a problem, could even a naive pure Julia matrix multiply 
(etc. I do not really know this are care too much about [multi] linear 
algebra) substitute do? Not for everything.. Just so that not everything 
falls apart..

FFTW (>= 3.3) — library for computing fast Fourier transforms very quickly 
and efficiently.PCRE (>= 8.31) — Perl-compatible regular expressions 
library.
Skip. Still wander if supporting would be possible?

GMP (>= 5.0) — GNU multiple precision arithmetic library, needed for BigInt 
support.
Skip - just reduced functionality, OR as integers are not really supported 
in JS, support this as the default Int..

MPFR (>= 3.0) — GNU multiple precision floating point library, needed for 
arbitrary precision floating point (BigFloat) support.
Skip

libgit2 (>= 0.21) — Git linkable library, used by Julia's package manager
How critical is this? Only for developers or just to get any Julia code 
running?

utf8proc (>= 1.2) — a library for processing UTF-8 encoded Unicode strings
I guess needed, not something JS has as a substitute..

libosxunwind — clone of libunwind, a library that determines the call-chain 
of a program
Is this only needed for when you get errors? Seems difficult to support, at 
least for some BSD..

-- 
Palli.


That seems like an awfully daunting task – especially getting all those 
> numerical libraries working. OpenBLAS uses an extensive amount of assembly 
> (and MKL is only available in binary form), so for linear algebra, the 
> whole approach unravels.
>
>
> On Mon, Sep 2, 2013 at 1:54 PM, John Myles White <[email protected] 
> <javascript:>> wrote:
>
>> Check out the code_llvm() function: 
>> http://docs.julialang.org/en/latest/manual/metaprogramming/#reflection
>>
>>  -- John
>>
>> On Sep 2, 2013, at 12:14 PM, Sven Mesecke <[email protected] <javascript:>> 
>> wrote:
>>
>> > Hi,
>> >
>> > given that Julia translates to LLVM, I was having some initial thoughts 
>> about translating Julia to Javascript. However, I was unable to find some 
>> information on how I could get the LLVM code. Any pointers so that I could 
>> give it a try? Is there a way for the user to translate Julia to LLVM?
>> >
>> > Thanks,
>> > best,
>> > Sven
>>
>>
>

Reply via email to