Using D
Bruno Medeiros via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 5 04:27:16 PDT 2014
On 04/09/2014 16:21, Chris wrote:
> On Thursday, 4 September 2014 at 14:19:02 UTC, Bruno Medeiros wrote:
>> On 26/08/2014 09:46, Chris wrote:
>>> The problem was that Java didn't behave as expected on Windows. Things
>>> that worked fine on Linux and OS X didn't work on Windows (even simple
>>> things like deleting files). User reported all sorts of problems, one of
>>> them being that the Java Access Bridge didn't work. Why, nobody knows.
>>> The lack of a proper sound API / library. Then there was the versioning
>>> hell with JRE/JVM and having to tell users what version they had to
>>> download (the non tech savvy crowd). I know that MS doesn't make it easy
>>> for Java either. Well, I could have sorted the problems out with Java
>>> web start, SWT and all that kind of stuff. Instead, I learned D which I
>>> can compile and run on each platform without a problem.
>>
>> The promise of "Write once run everywhere" is still pretty much
>> accurate if you stick to core Java code and libraries. Of course once
>> you start using OS/implementation specific code you will have to code
>> more carefully, and are more likely to encounter cross-platform
>> problems. That's just the nature of things, you can't say it's a
>> failure of Java.
>> It's like coding in D using lots of malloc/free in your code, and then
>> when your program breaks, you complain that "the D GC doesn't work!".
>> Of course the GC only is only guaranteed to work if you stick to
>> GC-managed memory.
>
> I can expect the Java Access Bridge to work, because Java offers it as a
> built-in technology. If it does not work, it's a broken promise. Simple
> as that.
>
Does Java Access Bridge really not work, or you just didn't use it
right? Or are you trying to use in for a purpose it's aimed to be used?
Unfortunately, I'm not familiar with JAB, so I can't comment further on it..
>> To be honest I smell a load of Java-biased *BS* here, especially
>> because of this sentence:
>> "Instead, I learned D which I can compile and run on each platform
>> without a problem."
>
> Which is true. I could compile it on Linux, OS X and Windows. It was
> almost trivial to write a DLL that third party software can use. Try
> that with Java and tell me if it's trivially easy. I think what you
> meant was _anti_-Java *BS*. I'm only writing about my experience with
> the two languages. The one worked for me, the other didn't.
>
When you say DLL, do you mean a shared library in general, or really an
actual Windows DLL? I'm assuming it's the former, otherwise that doesn't
make sense. Well In Java you can create them quite easily: jars. They
are trivial to be used by other Java programs! I don't see your point.
>> Actually virtually all other languages, including D, are just as bad
>> as Java (if not worse) in the aspects mentioned above. For example, if
>> you write code which heavily interacts with the filesystem, you are
>> bound to encounter platform/OS-specific problems no matter what
>> language. I'd bet money those "even simple things like deleting
>> files", you'd have in D as well. At least in Java the APIs they are
>> usually careful to specify which aspects of behavior are
>> implementation-specific.
>
> Well, my statement refered to the fact that Java f**ked up big time
> there, which clearly breaks the promise "write once, run everywhere",
> especially because dealing with files is a feature one would expect to
> be part and parcel of a programming language. Deleting files should not
> give you a headache. Basically what you're saying is "Java is
> cross-platform but it's not, but hey, other languages are just as bad!".
> Well, then they should stop using the word "cross-platform" when
> advertising their language.
>
If the core of the language was "working with with filesystem", then
yeah, they should not advertise it as cross-platform. But it's not the
core of language (even if it's part of the standard library), it's just
a minor library component, one amongst many (the vast majority of it
being fully cross-platform).
>> In other cases, such as the sound library or accessibility library,
>> most other cross-platform language don't even have those!, so how can
>> you be saying that D runs better on each platform that Java?..
>> (Does a non-existent library run perfectly on every conceivable
>> platform? one could say yes...)
>
> D interfaces to existing audio / sound libraries in C (libsndfile,
> portaudio). All you have to do is to include those libs and call the
> functions you need. Doing this with Java is a bit more complicated
> (you'll probably need tools).
>
> You are welcome to report on any serious issues you've encountered when
> porting D programs to various platforms. Maybe it can be fixed in the
> core of the language and it would help to make D even more portable. A
> lot of cross-platform issues can be dealt with by including
> "version(Windows/Posix ...)" in your code.
--
Bruno Medeiros
https://twitter.com/brunodomedeiros
More information about the Digitalmars-d
mailing list