POV-Ray : Newsgroups : povray.off-topic : Lots of statistics : Re: C# Server Time
29 Jul 2024 14:19:58 EDT (-0400)
  Re: C#  
From: Darren New
Date: 18 Aug 2012 13:43:33
Message: <502fd445$1@news.povray.org>
On 8/18/2012 3:14, Orchid Win7 v1 wrote:
> I very much doubt that C# lets you trivially call arbitrary machine code.

You would be mistaken. It's no harder in C# to call COM or C code than it is 
to do so from C++. Machine code? Well, you have to know the calling 
convention, but sure, you can do that.

> In that case, yeah, it ought to be possible to build something that does
> this. Nobody has, but somebody could.

OK, so Haskell supports dynamic loading of code including declaring new 
types? Funky.

> And, as I wrote in the part you snipped, this is a property of the one
> extant Haskell compiler. It's not necessarily intrinsic to the language
> itself. Somebody could write a compiler that /does/ have good object code
> compatibility. It's just that to date, it hasn't been a priority. There's
> nothing about the /language design/ that makes this impossible.

Sure. But some systems are designed to make this easy, and some aren't. For 
example, it's a lot harder to write a C# compiler that does *not* have good 
object code compatibility.

Of course any language can manage pretty much any function with enough 
effort. Even BASIC can have good object-code compatibility if you work hard 
enough at it. (I think they call it VB.NET, ;-)  The question is how much 
effort does it take, and how much does it look like part of the language 
when you're done.


>>>> How elegantly does it interface to dynamic languages like javascript?
>>>
>>> What do you mean by "interface"?
>>
>> Can you invoke a javascript library as if it were written in Haskell?
>> I.e., is it as easy to invoke something like javascript as it is to
>> invoke something like C?
>
> Don't you need a web browser to run JavaScript code?

Why would you need a web browser?

> Regardless, invoking JS is, in principle, similar to invoking any other
> foreign language. Once you work out how to call it, you'd need to write at
> least some trivial wrappers to get it to work, and after that it's pretty easy.

Except that JS is dynamically-typed. So you can't write a wrapper to a JS 
function. Plus, of *course* you *can* manage it. It's turing complete and 
runs on the same machine. The point is whether it's easy to take a lazy 
functional declarative language and conveniently invoke a stateful 
dynamically-typed collection of functions and objects. I can't even imagine 
how you'd write a wrapper for something like that, in terms of declaring it 
and invoking it. I.e., I don't even know how you'd be able to write a 
Haskell declaration of a javascript object, even assuming such library was 
already written.

> And that's what I'm saying. Most of the stuff you can't do with Haskell
> right now isn't because of poor language design. It's just that nobody has
> built the tools or libraries required to do it. Some day these things
> /could/ become possible, without changing the language.

OK. It wasn't obvious to me that the design of the language was such that 
you could have the things I was talking about.

>> Not superior. Superior at various tasks.
>
>  From what I can see, C# is superior at migrating C++ code and letting it
> integrate with old VB code...

You barely even know how it works, and you've not written any significant 
programs in it, so you're judging from a position of ignorance. :-)

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.