Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9420
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: back to .Net? lesser of two evils? |
| Date | 2011-11-02 21:34 -0700 |
| Organization | albasani.net |
| Message-ID | <j8t5kr$1mj$1@news.albasani.net> (permalink) |
| References | (3 earlier) <j8rnie$16h$1@dont-email.me> <j8rt6b$i78$1@news.albasani.net> <j8ru2g$h0j$1@dont-email.me> <j8scuj$nuq$1@news.albasani.net> <4582482.388.1320279654255.JavaMail.geo-discussion-forums@prog16> |
On 11/2/2011 5:20 PM, Lew wrote: > BGB wrote: >> markspace wrote: >>> BGB wrote: >>>> for example, someone could make an extended form of Java >>>> which adds ifdef's... >>> >>> I rest my case. :-) >>> >> >> but, ifdef is a useful and powerful feature... > > Only useful for a non-portable language. > C and C++ apps run on plenty enough targets to demonstrate that they are useful for portable code. > This does not establish that it would be useful for Java. > it would, however, allow it to be better used in contexts where trying to use it would have it fall on its face. granted, probably in 95% of code one would not likely ever see it... >> also, C# has ifdef, so it probably isn't all bad. > > Lame reasoning. > > How does presence in C# argue for or against the quality of a feature compared to its presence in Java? It would be equally valid to argue that "ifdef" is bad because Java omits it. > it being present in C# indicates that MS thought it was a good idea to include it (much like pointers and goto...). much less pain is felt from a never-used feature than from a needed-but-absent feature. > Do try to avoid invalid reasoning, hm? > >> granted, it may reflect a different development philosophy: > > Again, not speaking to whether "ifdef" is a good or bad feature. > >> what motivates people to choose, say, Java, or C#, or C++, or C, or ... >> may in turn be driven by different sets of views and development goals. > > Still not speaking to whether "ifdef" is a good or bad feature. > not every statement has to be an argument, but may instead serve to give relevant context. >> so, Java tries to gain portability via homogeneity. >> so, the same code works everywhere, because everywhere is the same. > > And this is bad because ... ? > it is not "bad", rather it is what they were doing. it is a particular strategy, but not the only strategy, nor necessarily the optimal strategy. >> C and C++ via being flexible towards heterogeneity. > > Which "flexibility" causes infamous difficulties. > but, it does work in the case where systems can't agree on such little details as how to allocate memory, create threads, access network sockets, ... the point is that they still work, rather than running head first into a wall which is like "nope, can't do this" (apart maybe from even more nasty hacks, such as jerking off with the classloader). >> each place is different, but things like typedefs/ifdefs/... can help >> gloss over most of the differences. > > For certain values of "help". "#ifdef" also horribly complicates C and C++ code and horribly damages readability. This is a good thing? > it makes it work on more targets, which is generally considered a good thing. granted, well organized code will tend to limit the overuse of ifdefs, generally limiting its use to regions of code meant to glue between the application logic and target-specific features. >> granted, it would be nice to have a consistent platform, such that one >> doesn't really need piles of ifdef's everywhere, but this is not the >> fault of the existence of ifdef's proper. > > You have it backwards. "#ifdef" is a reaction to a fault, not a cause. > if one had everything perfect, granted one wouldn't likely need ifdef, however Java isn't necessarily perfect, and there are cases where such a feature (among others) would be useful. ideally, it would remain as a reasonably rarely-used feature, however. granted, I don't believe it should be exactly the same as in C, since with C's semantics it would conflict with the goal of WORA (by making compiled classes only work on targets with the intended feature-set). so, the goal would be that it would be left to the JVM proper, which would itself evaluate whether or not a given feature is present (after loading the JAR and feeding any such classes into the classloader). in the class files, this could likely take the form of special attributes or similar (these attached to methods or variables, telling the VM whether to include or omit them). in my own VM, I had ended up implementing ifdef and ifndef partly via special conditional-call instructions (the contents of the conditional block were folded into their own method body, similar to a closure/lambda, and if the requisite condition was false, then the VM would pretend both the block and the special call instruction did not exist). >> in a completely homogenous environment, most likely people would simply >> not need them. however, if one doesn't have them, but are faced with a >> heterogeneous platform (say, standard JVM vs Android), then one has a >> mess... > > Since "standard JVM" doesn't run on Android, and Dalvik doesn't run elsewhere, I fail to see the problem. > one may want to write the same app with the same code (say, for PC and Android), and have it run in both cases. one is otherwise left with: writing different app code, possibly having annoying synchronization issues; having to use a preprocessor (such as the C preprocessor) to produce the desired version in each case; ... > J2ME is even less compatible with "standard JVM", whatever the heck that is. > "standard JVM" would basically mean: Java SE or similar; the VM runs JAR's and class files; ... this is to contrast against a "nonstandard JVM", which would include, say: Dalvik; compiling to native code; J++ and J#; ... >> granted, apparently (from stuff encountered elsewhere online) some >> people have been dealing with some of these issues by feeding Java code >> through the C preprocessor (presumably just prior to feeding it to >> javac), but I don't know how widespread this sort of practice is. > > Hopefully not very. > given people have made reference to doing this (encountered when searching for other things online), it would seem that at least some people are doing this. granted, this is kind of a lame option, because any apps produced this way would no longer exhibit the WORA goal... granted, code with a lot of ifdefs could potentially run into targets with an incompatible featureset, and then fail to work correctly. if done well, this should be fairly rare. >> or such... > > What is that "or such..." about, anyway? > personal habit...
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
back to .Net? lesser of two evils? jebblue <n@n.nnn> - 2011-10-28 15:29 -0500
Re: back to .Net? lesser of two evils? Steve Sobol <sjsobol@JustThe.net> - 2011-10-28 15:16 -0700
Re: back to .Net? lesser of two evils? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-02 07:05 -0300
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 22:46 -0400
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-01 22:18 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-01 22:35 -0700
Re: back to .Net? lesser of two evils? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-02 03:17 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 07:58 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:06 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-03 00:01 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 20:48 -0400
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 20:52 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 07:21 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-09 20:30 -0500
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 22:48 -0700
Re: back to .Net? lesser of two evils? coder <j-code@speak.invalid> - 2011-11-02 17:36 -0400
Re: back to .Net? lesser of two evils? Lew <lewbloch@gmail.com> - 2011-11-02 17:13 -0700
Re: back to .Net? lesser of two evils? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-03 00:49 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-03 00:10 -0700
Re: back to .Net? lesser of two evils? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-03 04:41 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-03 05:36 -0700
Re: back to .Net? lesser of two evils? thoolen <tholen01@gmail.com> - 2011-11-02 23:13 -0700
Re: back to .Net? lesser of two evils? markspace <-@.> - 2011-11-02 08:28 -0700
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 10:04 -0700
Re: back to .Net? lesser of two evils? markspace <-@.> - 2011-11-02 10:19 -0700
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 14:32 -0700
Re: back to .Net? lesser of two evils? Lew <lewbloch@gmail.com> - 2011-11-02 17:20 -0700
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 21:34 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 20:57 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 09:25 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-09 20:25 -0500
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 23:05 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 17:26 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 15:01 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:18 -0400
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:20 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 22:30 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 21:30 -0400
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 21:40 -0400
Re: back to .Net? lesser of two evils? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-01 23:42 -0700
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 10:22 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:02 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 20:10 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 20:45 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 09:56 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:01 -0400
Re: back to .Net? lesser of two evils? markspace <-@.> - 2011-11-02 15:26 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 18:35 -0400
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-02 20:53 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 21:45 -0400
Re: back to .Net? lesser of two evils? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-04 05:50 -0300
Re: back to .Net? lesser of two evils? Lew <lewbloch@gmail.com> - 2011-11-04 10:39 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-04 17:38 -0400
Re: back to .Net? lesser of two evils? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-04 18:47 -0300
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 10:11 -0700
Re: back to .Net? lesser of two evils? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-09 20:24 -0500
Re: back to .Net? lesser of two evils? BGB <cr88192@hotmail.com> - 2011-11-09 23:42 -0700
csiph-web