Accidentally went off list for a bit.

On Mon, Apr 11, 2011 at 7:55 AM, Michal Suchanek <hramrach / centrum.cz>wrote:

> On 11 April 2011 14:35, Josh Cheek <josh.cheek / gmail.com> wrote:
> > On Mon, Apr 11, 2011 at 7:30 AM, Josh Cheek <josh.cheek / gmail.com>
> wrote:
> >>
> >> On Mon, Apr 11, 2011 at 6:48 AM, Michal Suchanek <hramrach / centrum.cz>
> >> wrote:
> >>>
> >>> On 11 April 2011 12:02, Josh Cheek <josh.cheek / gmail.com> wrote:
> >>> > On Mon, Apr 11, 2011 at 4:40 AM, Michal Suchanek <
> hramrach / centrum.cz>
> >>> > wrote:
> >>> >>
> >>> >> On 8 April 2011 15:03, Josh Cheek <josh.cheek / gmail.com> wrote:
> >>> >> > That is incredibly cool! But can you really implement *any*
> >>> >> > language?
> >>> >> > What
> >>> >> > about languages that are completely different from javascript? In
> >>> >> > Haskell,
> >>> >> > for example, everything happens lazily, data is immutable, there
> is
> >>> >> > a
> >>> >> > complex type system. Can you really map this right to javascript?
> >>> >> > (or am
> >>> >> > I
> >>> >> > misunderstanding OMeta?)
> >>> >> >
> >>> >>
> >>> >> This is incredibly cool but can you really translate any language
> into
> >>> >> machine code?
> >>> >> What about languages that are completely different from machine
> code?
> >>> >> In Haskell, for example, everything happens lazily, data is
> immutable,
> >>> >> there is a complex type system. Can you really map this right to
> >>> >> machine code? (Or am I misunderstanding your question?)
> >>> >>
> >>> >> Thanks
> >>> >>
> >>> >> Michal
> >>> >
> >>> > Your phraseology is confusing, but yes, I assume you are
> >>> > misunderstanding my
> >>> > question. In the video, he didn't translate to machine code, he
> >>> > translated
> >>> > to javascript which he then interpreted (at least that is how I
> >>> > understand
> >>> > it). Also, I am also pretty confident that Haskell doesn't map
> straight
> >>> > into
> >>> > machine code, I think it must embed a runtime to manage things like
> >>> > thunks
> >>> > and garbage collection.
> >>> >
> >>>
> >>> And how is translating to JavaScript different from translating to
> >>> machine code?
> >>>
> >>> Thanks
> >>>
> >>> Michal
> >>
> >> First of all, can JS even generate and execute machine code? I'd expect
> >> that to require knowledge of the platform and to be handled within the
> >> interpreter, not at the language level. IDK, I'll assume we mean
> assembly
> >> code for the rest of the post.
> >>
> >> Assembly (x86, anyway, IDK anything at all about any other kinds) is
> based
> >> on a certain infrastructure such as a stack, a heap, registers that keep
> >> track of where you are at in your code, where you are at on the stack,
> and
> >> so forth (I'm not positive these registers *must* be used this way, but
> at
> >> least that is how I've always seen them used). AFAIK, JS doesn't have
> these
> >> inherently. You could construct a framework that mimics a computer, and
> then
>
> Presumably OMeta is as complete as x86 assembly. Quite likely it has
> different set of primitives (or insctructions) but that does not mean
> translating to it is any more challenging than to x86 assembly to
> which all the named languages were translated already.
>
>
Ruby isn't translated to Assembly, you must interpret it.


> >> recreate the assembly instruction set but :
> >>
> >> (a) that isn't what he did in the video
> >>
> >> (b) if your language requires a runtime, then it isn't translatable.
> Maybe
> >> you could embed the runtime into the output program, but does it count
> as a
> >> translation if you break 1:1 relationship between before and after code?
> >> Even compiled languages don't do this, joining libraries is done by the
> >> linker, after the code is translated. (I'm not clear on the difference
> >> between assemblers and compilers)
> >>
> >> (c) by mapping into JS, don't you lose all the qualities that the
> language
> >> has on its own? ie you have the weaknesses of your actual language on
> top of
> >> the languages of JS (ie I would expect C to be slower than JS now,
> because
> >> your C is being translated into what appears to be assembly
> instructions,
> >> but is actually JS, and your final code is actually a whole series of
> >> indirect JS commands) So if this is the case, you have a leaky
> abstraction
> >> (http://www.joelonsoftware.com/articles/LeakyAbstractions.html)
>
> I don't see the leak anywhere, nor do I see any reason to translate C to
> JS.
>
>
The hypothesis was that you could implement *any* language. C falls within
that set. The leak is that JavaScript does not have the properties of
assembly. There is a reason you don't write systems level code with
interpreted languages, because they have very different properties. Wouldn't
implementing a systems level language in an interpreted language cause the
systems level language to lose the attributes that make it a viable choice
for such a domain?

>>
> >>
> >> Anyway, if you read my post, you'll see I didn't assert that it can't be
> >> done, I just asked whether it could. If you think it can and it's
> obvious,
> >> then how about an explanation of the process. If not, then why do you
> keep
> >> asking me these questions? I'm not an expert on the domain, I just
> watched
> >> the video.
> >
> > Also, why are we off list?
> >
> Because some three emails back you sent the email only to me, not the list.
>
>
Hmm, seems to be because you CC'd me in your response to the ML, so when I
hit reply, gmail sent it to you instead of the list. I changed the recipient
of this one, hopefully we're back on list. You might change your client to
avoid that, it seems unlikely that I'll be the only one to do this.