Will Deakin <anisotro...@hotmail.com> writes: > Kenny Tilton wrote:
> [...elided stuff about java...]
> > And the GC sucks.
> I realise this is an arse thing to ask, but, can you give an > justification for this? that is, are there any papers comparing java > with lisp, say?
Ah, thank you for following up here, because I'd meant to reply to Kenny's article. Java GC certainly sucked at first. However, in true Worse-is-Better form, they started out with a crappy GC (which, for people coming from non-GC languages was probably a godsend) and worried about making the GC good later. Well, later came, and AFAICT, there are good GCs for Java now. Although, come to think of it, I can only remember reading papers about Java GCs on Sun hardware, so it's possible that Java GC still sucks on Intel hardware, I don't know.
One problem with the Java approach of start with a bad GC, then develop good ones later, though, is that it let Java users develop a poisonous culture of writing finalizers that must be run in a timely manner. This worked at first, but introduce generaltional GC, and suddenly you've got unreleased resources in older generations that aren't being collected. Active Java users would probably have a better idea about how much of a problem this still is, but any code base that does this pretty much requires a poor GC.
Oh, and to answer your question, I don't know of any, but if you look for papers on Java GCs, you'll often find references to papers on Lisp GCs. So, there's comparison of a sort.
-- /|_ .-----------------------. ,' .\ / | No to Imperialist war | ,--' _,' | Wage class war! | / / `-----------------------' ( -. | | ) | (`-. '--.) `. )----'
> > I realise this is an arse thing to ask, but, can you give an > > justification for this? that is, are there any papers comparing java > > with lisp, say?
> Ah, thank you for following up here, because I'd meant to reply to > Kenny's article. Java GC certainly sucked at first.
Right, and I think it important in this language war to ignore improvements and forever characterize a language according to the attributes it held in the first few weeks after the initial release. Lisp is slow, right? Because it's interpreted! Uses too much memory, too.
> > I realise this is an arse thing to ask, but, can you give an > > justification for this? that is, are there any papers comparing java > > with lisp, say?
> Ah, thank you for following up here, because I'd meant to reply to > Kenny's article. Java GC certainly sucked at first. However, in true > Worse-is-Better form, they started out with a crappy GC (which, for > people coming from non-GC languages was probably a godsend) and
Yes indeed. Many people had their first exposure to GC then. That was a good thing.
[...]
> One problem with the Java approach of start with a bad GC, then > develop good ones later, though, is that it let Java users develop a > poisonous culture of writing finalizers that must be run in a timely > manner. This worked at first, but introduce generaltional GC, and
[...]
Finalizers are one of my pet peeves with Java; more precisely, the fact that Java doesn't have destructors. People coming from a C++ tradition look for the destructor, don't find it, and use the finalizer. The only good use i can think of for a finalizer is to release memory that has been malloc-ed outside of the garbage collector (perhaps as part of a native interface method). Stay away from finalizers -- they're evil.
Now, not having a destructor, we're forever having to code stuff like:
try { open database connection, do stuff } finally { close database connection }
when this should have been handled transparently in the destructor.
glauber wrote: > Now, not having a destructor, we're forever having to code stuff like:
> try { open database connection, do stuff } > finally { close database connection }
> when this should have been handled transparently in the destructor.
Working as a (sometime) Oracle DBA I would say that this has done more than peeved me, due to naiveity on the part of some developers this caused the death by cursor starvation of an live Oracle database running on a meaty E4500...
theglau...@my-deja.com (glauber) writes: > Finalizers are one of my pet peeves with Java; more precisely, the > fact that Java doesn't have destructors. People coming from a C++ > tradition look for the destructor, don't find it, and use the > finalizer. The only good use i can think of for a finalizer is to > release memory that has been malloc-ed outside of the garbage > collector (perhaps as part of a native interface method). Stay away > from finalizers -- they're evil.
> Now, not having a destructor, we're forever having to code stuff like:
> try { open database connection, do stuff } > finally { close database connection }
> when this should have been handled transparently in the destructor.
The problem is that destructors and GC in Java don't mix very well. Every object is in fact a pointer to the object data. How does the system know when the destructor should be called? The object being referenced might very well being returned out of scope, in which case it should *not* be destructed.
If Java had some sort of stack-based "struct" type, such a thing could have scope-based destructors. But such things would not fit with the rest of Java, by-value/by-reference/identity issues would arise, etc.
I want scope-based destructors too, but what I would do is to add to Java a sort of compromise: have a scope-based construct that does not complicate Java's type system but yet allows the programmer to easily express scope-based management (essentially a form of Lisp-style with-xxx macros):
Connection c = new Connection(...); with (c) { ...do stuff... }
Such a construct would be equivalent to:
Connection c = new Connection(...); try { c.initializeResource(); ...do stuff... } finally { c.finalizeResource(success); }
with the added requirement that c implement some sort of ControlledResource interface that mandates the initializeResource() and finalizeResource() methods.
Then the decision of when to "destruct" is up to the programmer (this is the compromise), but things are easy to express, making it straightforward to repeat a "managed scope" while minimizing the possibility of introducing an error in the resource management logic.
Followups to comp.lang.java.machine where this kind of thing can be better discussed [and is a counterpoint to Edward Diener's current proposal for a resource type].
-- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, bl...@telus.net The Rhythm has my soul.
In article <3216205787209...@naggum.net>, Erik Naggum <e...@naggum.net> wrote:
>[...] > I may be biased, but I tend to find a much lower tendency among female > programmers to be dishonest about their skills, and thus do not say they > know C++ when they are smart enough to realize that that would be a lie > for all but perhaps 5 people on this planet.
Now, I'd say I know quite much of C++. I do it nearly every work day, even though I'm not too glad about it (there are those Erlang/... days :-) ).
Yes, I *know* that I don't know all of C++. Who does? Just read those Guru of the Week thingies or similar in comp.lang.c++.moderated. Read some strange template-based code. etc.
Still, I know enough of C++ to program useful things. It's more effective than pure C, I guess. Perhaps if I had already invested the same effort into e.g. Lisp, I'd be even more productive. However, alas, technological merits aren't the only things that count in industry.
>[...] > amends unless you threaten him. C++ is a language that encourages such > cheating and lying because you _have_ to tell your compiler something you > cannot possibly know, yet, such as the type of all your variables and > functions, and then you make up a reality that fits the lies.
That particular point doesn't match my experience. Usually my assertions about types (which are checked according to the type system) are true, at least *now*. Maybe they'll become wrong due to evolution of the system I'm (co)developing. Then there may be excessive changes to the type declarations etc., of course, but still, usually things are true *now*. Except you excessively cheat yourself around the type systems using casts or things like that.
> This does > not appear to appeal to many female programmers. Java is a _lot_ better > than C++ in this regard in that the amount of required cheating and lying > is dramatically reduced by the more flexible type system and the > existence of so much more stuff that dictates the types to use. (Common > Lisp is even better, of course, but it just not "there" when people look > for something to learn if they think they like programming computers.)
Now, frankly, C++'s type system is usually more expressive. You can map almost everything save for GC-based issues from Java into C++, but not necessarily vice versa.
In C++ you say std::map<KeyType, ValueType>. In Java you just use some map type and have to cast values you retrieve dynamically to the type you expect. You have to slightly cheat around the type system in Java in this case. (There are Java extensions that fix that deficiency, and AFAIK the solution of generic classes is in fact cleaner than C++'s templates.)
>[...]
So far. However, I don't really like using such simple drawers like "male" and "female". All too often, more or less slight correlations are used to build up gender stereotyping, gender prejudices and self-fulfilling prophecies. An example for the latter: "Women are better at home. Let's educate our daughter in cooking and not in those strange outside-world related things". The consequence is clear: The daughter will have a disadvantage in outside-world things and an advantage in cooking knowledge. So the prejudice has come true in this case, has been reproduced. (It's only strange to see that many professional cooks are men...) If done in great numbers, women, statistically, *are* really better in cooking, but with no inherency of that trait or correlation at all.
theglau...@my-deja.com (glauber) writes: > Finalizers are one of my pet peeves with Java; more precisely, the > fact that Java doesn't have destructors. People coming from a C++ > tradition look for the destructor, don't find it, and use the > finalizer. The only good use i can think of for a finalizer is to > release memory that has been malloc-ed outside of the garbage > collector (perhaps as part of a native interface method). Stay away > from finalizers -- they're evil.
That, and as a sort of safety net: check to see if whatever resource that should have been freed, was, and, if not, free it and log a warning.
> Now, not having a destructor, we're forever having to code stuff like:
> try { open database connection, do stuff } > finally { close database connection }
> when this should have been handled transparently in the destructor.
It should have? Java objects (like Lisp objects) have indefinate extent. I'm not sure how you think a destructor would be any different than a finalizer. If Java had a macro system, you could make WITH-... style macros to make that idiom nicer, but I don't see the problem with it. The object has indefinate extent, and the GC handles the memory management. DB handles aren't memory, so you're going to have to manage them yourself. It's just too bad (for the people tracking down bugs caused by people who didn't write the try{}finally{} code) that Java doesn't have a convenient way to make WITH-... macros, or even CALL-WITH-... functions (why do people use this language instead of SmallTalk, again?).
-- /|_ .-----------------------. ,' .\ / | No to Imperialist war | ,--' _,' | Wage class war! | / / `-----------------------' ( -. | | ) | (`-. '--.) `. )----'
> amends unless you threaten him. C++ is a language that encourages such > cheating and lying because you _have_ to tell your compiler something you > cannot possibly know, yet, such as the type of all your variables and > functions, and then you make up a reality that fits the lies.
* Hannah Schroeter | That particular point doesn't match my experience. Usually my assertions | about types (which are checked according to the type system) are true, at | least *now*. Maybe they'll become wrong due to evolution of the system | I'm (co)developing. Then there may be excessive changes to the type | declarations etc., of course, but still, usually things are true *now*. | Except you excessively cheat yourself around the type systems using casts | or things like that.
But things that are true _now_ which turn out to be false a short time later are generally regarded as unpredictable. The problem is that you have to make those changes without any changes in external requirements, they are required as your knowledge of only your _own_ code increases. I consider this to be a case of being forced to say that something is true when you are clearly not certain that it is, and then when you cannot make up a credible world around it so it holds true, you change your testimony, as it were.
| Now, frankly, C++'s type system is usually more expressive. You can map | almost everything save for GC-based issues from Java into C++, but not | necessarily vice versa.
This is actually an argument that C++ is a lower-level language than Java. The most expressive type system is that of machine language, or assembler. We sacrifice expressibility on one level to attain it another.
| However, I don't really like using such simple drawers like "male" and | "female".
People actually do come in these easily labeled packages. The difference is whether one confuses the descriptive and the prescriptive statements. Induction is a tricky business, prediction even more so. I really tried to avoid both and just report my observations so far. See my signature for a hopefully succinct summary of all the possible arguments why I think you misdirected your comments on stereotyping.
/// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted.
In article <892f97d1.0112040814.5347c...@posting.google.com>, glauber wrote: >t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) wrote in message <news:xcvsnas6lf2.fsf@apocalypse.OCF.Berkeley.EDU>... >> Will Deakin <anisotro...@hotmail.com> writes:
>> > Kenny Tilton wrote:
>> > [...elided stuff about java...]
>> > > And the GC sucks.
>> > I realise this is an arse thing to ask, but, can you give an >> > justification for this? that is, are there any papers comparing java >> > with lisp, say?
>> Ah, thank you for following up here, because I'd meant to reply to >> Kenny's article. Java GC certainly sucked at first. However, in true >> Worse-is-Better form, they started out with a crappy GC (which, for >> people coming from non-GC languages was probably a godsend) and
>Yes indeed. Many people had their first exposure to GC then. That was >a good thing.
>[...]
>> One problem with the Java approach of start with a bad GC, then >> develop good ones later, though, is that it let Java users develop a >> poisonous culture of writing finalizers that must be run in a timely >> manner. This worked at first, but introduce generaltional GC, and
>[...]
>Finalizers are one of my pet peeves with Java; more precisely, the >fact that Java doesn't have destructors. People coming from a C++ >tradition look for the destructor, don't find it, and use the >finalizer. The only good use i can think of for a finalizer is to >release memory that has been malloc-ed outside of the garbage >collector (perhaps as part of a native interface method). Stay away >from finalizers -- they're evil.
>Now, not having a destructor, we're forever having to code stuff like:
>try { open database connection, do stuff } >finally { close database connection }
>when this should have been handled transparently in the destructor.
Or perhaps it should be handled by a language feature that the programmer can define himself:
Destructors are not necessarily the answer. Using the destruction of an object to clean up its state is a really semantic hack; in C++ you force the destruction of the object in order to make it close the database connection that it manages as a side effect.
If you have way to build language *features* that have built in unwind trapping and cleanup, you don't need to rely on your class system to provide the only halfway convenient substrate for doing it.
In article <892f97d1.0112040814.5347c...@posting.google.com>, glauber wrote: >Finalizers are one of my pet peeves with Java; more precisely, the >fact that Java doesn't have destructors. People coming from a C++ >tradition look for the destructor, don't find it, and use the >finalizer. The only good use i can think of for a finalizer is to >release memory that has been malloc-ed outside of the garbage >collector (perhaps as part of a native interface method). Stay away >from finalizers -- they're evil.
>Now, not having a destructor, we're forever having to code stuff like:
>try { open database connection, do stuff } >finally { close database connection }
>when this should have been handled transparently in the destructor.
Or perhaps it should be handled by a language feature that the programmer can define himself:
Destructors are not necessarily the answer. Using the destruction of an object to clean up its state is a really semantic hack; in C++ you force the destruction of the object in order to make it close the database connection that it manages as a side effect.
If you have way to build language *features* that have built in unwind trapping and cleanup, you don't need to rely on your class system to provide the only halfway convenient substrate for doing it.
t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> worried about making the GC good later. Well, later came, and AFAICT, > there are good GCs for Java now.
I'm actually a bit scared that given the amount of money used on the development of java run time systems, there might come the day when java GC is significantly better than lisp GC - and even worse: That the new GC methods are (C) some company that won't give away their stuff to the lisp vendors. -- (espen)
This is a really interesting connection that I've noticed before. The desire for `destructors' in a language *actually* turns out to be due to the lack of sufficient linguistic flexibility, specifically the lack of a proper macro system.
Actually, I think that the only interesting property of any language is a sufficiently hairy macro system. Who needs to actually compute anything when you can expand macros. C++ seems to be realising this with templates. They haven't quite got there yet, but fairly soon they'll work out that you don't need to ship the system at all, you just ship some *really complicated* templates, and the compiler. Soon, to boot windows you'll just say `gcc windows-xp.cpp > /dev/mem'.
Espen Vestre <espen@*do-not-spam-me*.vestre.net> wrote in message <news:w6n10yq8y1.fsf@wallace.ws.nextra.no>... > I'm actually a bit scared that given the amount of money used on > the development of java run time systems, there might come the day > when java GC is significantly better than lisp GC - and even worse: > That the new GC methods are (C) some company that won't give away > their stuff to the lisp vendors.
This is kind of a sarcastic response, so take it with a pinch of salt...
Have you measured GC overhead recently? Will Deakin & I did some tests (he did most of them) for a fairly consy program on a number of machines & CL systems. I think the worst was ~6% runtime, the best was 2 or 3%. None of these were tuned at all, I'd guess that for a highly-tunable system like ACL (which I think was at the low end already), you could likely shave another couple of percent off, leaving you with maybe 1-2%. It's in the noise.
The reason this is slighly tongue in cheek is that one place where there probably are big wins are GCs for multithreaded systems on multiple-processor machines. a GC that takes 5% and serialises the program will start to hurt at 20 processors, which is not very large (though not exactly a desktop either). And Sun have a big interest in a multithreaded system (Java) and multiple-processor machines, so there may be interesting developments there. However I'm not sure if that problem is not already mostly-solved in academia.
k...@ashi.footprints.net (Kaz Kylheku) wrote in message <news:yRbP7.21890$nm3.951762@news1.rdc1.bc.home.com>... > In article <892f97d1.0112040814.5347c...@posting.google.com>, glauber wrote: [...] > >Now, not having a destructor, we're forever having to code stuff like:
> >try { open database connection, do stuff } > >finally { close database connection }
> >when this should have been handled transparently in the destructor.
> Or perhaps it should be handled by a language feature that the programmer > can define himself:
Yes. C++ attempted to eliminate macros, but it provides features that are powerful enough to replace most of the use we did of macros in C. Java eliminates macros but gives very little to replace them. Lisp macros are the best.
The problem of the
try { do something with the database } finally { release resources }
is that it's verbose, and people forget to do it. Many Java programmers never use the finally clause of the try block (i know...). Specifically with databases, sometimes it's not clear what you need to release (statements? result sets? all of the above?). I've worked with a buggy driver (IBM's DB2 level 4 driver) that locks up when you try to release a result set. :-( This leads to bugs that are hard to reproduce, because depending on your application's memory usage, the finalizer may indeed be called and release the resource for you (or not, depending on how the driver's developer coded it).
In Java, the only way to extend the language is by subclassing. Sometimes this forces people into a better design, but sometimes the mechanism is just not powerful enough.
tfb+goo...@tfeb.org (Tim Bradshaw) writes: > The reason this is slighly tongue in cheek is that one place where > there probably are big wins are GCs for multithreaded systems on > multiple-processor machines. a GC that takes 5% and serialises the > program will start to hurt at 20 processors, which is not very large > (though not exactly a desktop either). And Sun have a big interest in > a multithreaded system (Java) and multiple-processor machines, so > there may be interesting developments there. However I'm not sure if > that problem is not already mostly-solved in academia.
In fact, the last time I looked through GC papers, this was the most interesting area, and the one where Java seemed to be dominating. Java's probably not quite as good a target for GC as SmallTalk or Lisp[*], but they seem to have gotten the single-processing stuff down, I think about as well as it's going to get for anyone. Where they're going to murder Lisp in on multiprocessing. We don't even *have* properly multiprocessing Lisps, do we? Like the kind that can make use of more than 4 processors? That's where the cool GC research in Java is going, AFAICT.
[*] I'd suspected that dynamically-typed languages are better for GC because statically-typed ones encourage the programmer to do some manual memory management by holding on to some stuff that's probably garbage, and generally forcing the programmer to think more about when they get things and let them go. This might just be an artifact of the code I've seen from others (I don't think I could make that judgment on my own code very well), but I think I read a paper that confirmed my suspicions. I say "I think" because I can't find it (moved 3 times in the last year), and without double-checking, I might've been just hearing what I wanted to hear :-)
-- /|_ .-----------------------. ,' .\ / | No to Imperialist war | ,--' _,' | Wage class war! | / / `-----------------------' ( -. | | ) | (`-. '--.) `. )----'
t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> down, I think about as well as it's going to get for anyone. Where > they're going to murder Lisp in on multiprocessing. We don't even > *have* properly multiprocessing Lisps, do we? Like the kind that can > make use of more than 4 processors? That's where the cool GC research > in Java is going, AFAICT.
I don't see a reason why garbage collection techniques developed for Java shouldn't be applicable to Lisp.
Andreas
-- "In my eyes it is never a crime to steal knowledge. It is a good theft. The pirate of knowledge is a good pirate." (Michel Serres)
tfb+goo...@tfeb.org (Tim Bradshaw) writes: > Have you measured GC overhead recently?
I'm actually not at all interested in the _percentual_ overhead, I would even accept 50% overhead if it could be done without loosing responsiveness, with the application at the same time being able to perform "almost hard real time".
I'm working with an application that runs for _months_, produces _tons_ of garbage and at the same time caches almost 1GB of data. I've tuned it to work amazingly well with LispWorks (*much* better than an earlier ACL version, btw), but I still can't get around the fact that I sometimes need to do memory defragmentation and sweeps of Generation 2. Each of these operations, which I usually run 1 or 2 times an hour in peak load hours, will last for about 10 - 30 seconds. For my specific application, a 30 seconds "blackout" once an hour is fully acceptable, but for other applications it's not, so I see a _very_ real need for almost hard real time lisp GC implementation like the one presented by Takeuchi at the JLUGM 2000. -- (espen)
> with the application at the same time being able to perform > "almost hard real time". Hmmm. Isn't this called "soft real time?"
> but I still can't get around the fact that I sometimes need to > do memory defragmentation and sweeps of Generation 2. Each of > these operations, which I usually run 1 or 2 times an hour in > peak load hours, will last for about 10 - 30 seconds. For my > specific application, a 30 seconds "blackout" once an hour is > fully acceptable, but for other applications it's not, Speaking from a position of complete ignorance -- often an advantage -- your descriptions indicates that you are using a form of generational gc. Would it not be more appropriate to use a non-generational gc?
Andreas Bogk <andr...@andreas.org> writes: > t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> > down, I think about as well as it's going to get for anyone. Where > > they're going to murder Lisp in on multiprocessing. We don't even > > *have* properly multiprocessing Lisps, do we? Like the kind that can > > make use of more than 4 processors? That's where the cool GC research > > in Java is going, AFAICT.
> I don't see a reason why garbage collection techniques developed for > Java shouldn't be applicable to Lisp.
Well, there are differences, but a lot of the research *could* be useful to us, too. But it would take lots of money to implement them, and we'd need to have the kind of multiprocessing Lisp systems they go with, which takes a *lot* more money. So, yeah, the only thing between us and them is a whole lot of money :-P
-- /|_ .-----------------------. ,' .\ / | No to Imperialist war | ,--' _,' | Wage class war! | / / `-----------------------' ( -. | | ) | (`-. '--.) `. )----'
t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> > I don't see a reason why garbage collection techniques developed for > > Java shouldn't be applicable to Lisp. > Well, there are differences, but a lot of the research *could* be > useful to us, too.
The differences are mainly in the area of finalization. For multiprocessing, issues are very much the same.
> But it would take lots of money to implement them,
Well, be glad you don't have to pay for the research in that area, that's even more expensive. And open-source development doesn't involve so much money, but rather finding somebody who will dedicate his spare time on the issue. Or his company time, for that matter, which tends to happen.
For the issue of multiprocessing GC, there's code available in the Boehm-Weiser conservative GC. It supports parallel marking in multiple threads. This GC is used by Java, Scheme, ML and Dylan implementations.
> and we'd need to have the kind of multiprocessing Lisp systems they go > with, which takes a *lot* more money.
Well, it suffices if, say, the CMUCL maintainers have access to a multiprocessing system. Money helps to get things done fast, but it can be substituted for with connections to the right people.
> So, yeah, the only thing > between us and them is a whole lot of money :-P
So let *them* spend it on research, lean back, and collect the fruits. :)
Andreas
-- "In my eyes it is never a crime to steal knowledge. It is a good theft. The pirate of knowledge is a good pirate." (Michel Serres)
(CLHS has find-class and (setf find-class) on the same page but class-name and (setf class-name) on separate pages, apparently because the latter two are generic functions.)
Tim Bradshaw wrote: > k...@ashi.footprints.net (Kaz Kylheku) wrote in message > <news:QQbP7.21889$nm3.951762@news1.rdc1.bc.home.com>... >> Or perhaps it should be handled by a language feature that the >> programmer can define himself:
> This is a really interesting connection that I've noticed before. The > desire for `destructors' in a language *actually* turns out to be due > to the lack of sufficient linguistic flexibility, specifically the > lack of a proper macro system.
Jonathan Bachrach and Keith Playford are working on an interesting macro system for Java
In article <9urbpn$hga$0...@news.t-online.com>, Michael Schuerig wrote: >Tim Bradshaw wrote:
>> k...@ashi.footprints.net (Kaz Kylheku) wrote in message >> <news:QQbP7.21889$nm3.951762@news1.rdc1.bc.home.com>... >>> Or perhaps it should be handled by a language feature that the >>> programmer can define himself:
>> This is a really interesting connection that I've noticed before. The >> desire for `destructors' in a language *actually* turns out to be due >> to the lack of sufficient linguistic flexibility, specifically the >> lack of a proper macro system.
>Jonathan Bachrach and Keith Playford are working on an interesting >macro system for Java
It's not really ``for'' Java; it's a new language that is translated into Java source code. The Java language isn't opened up to structural transformations, but is used as a back end.
If everyone brings his pet Java peprocessor to a project, you end up with code that is going through half a dozen text filters to produce executable code. What if, for instance, you want to use AspectJ and the Java Syntactic Expander at the same time?
The creator of Java, James Gosling, wrote a structural macro preprocessor for C called ACE, over ten years ago. Its aim was to perform code transformations with the primary aim of doing optimizations that the compiler isn't trusted to be able to do. http://java.sun.com/people/jag/ace/ace.html
To be done right, these things have to be done *in* the language not as a text processor *in front* of the language.
Kaz Kylheku wrote: > In article <9urbpn$hga$0...@news.t-online.com>, Michael Schuerig > wrote: >>Tim Bradshaw wrote:
>>> k...@ashi.footprints.net (Kaz Kylheku) wrote in message >>> <news:QQbP7.21889$nm3.951762@news1.rdc1.bc.home.com>... >>>> Or perhaps it should be handled by a language feature that the >>>> programmer can define himself:
>>> This is a really interesting connection that I've noticed before. >>> The desire for `destructors' in a language *actually* turns out to >>> be due to the lack of sufficient linguistic flexibility, >>> specifically the lack of a proper macro system.
>>Jonathan Bachrach and Keith Playford are working on an interesting >>macro system for Java
> It's not really ``for'' Java; it's a new language that is translated > into Java source code. The Java language isn't opened up to structural > transformations, but is used as a back end.
I'm not sure I understand the difference in this case. What would it mean for a macro system to be *in* Java instead of in front of it? Doesn't Java's syntax it close to impossible (better: undesirable) to have a macro system in the language?
> If everyone brings his pet Java peprocessor to a project, you end up > with code that is going through half a dozen text filters to produce > executable code. What if, for instance, you want to use AspectJ > and the Java Syntactic Expander at the same time?
I wouldn't want to. If I wanted to play around, I wouldn't use either as I wouldn't even use Java. On a serious project I'd consider it too dangerous to use extensions that significantly deviate from "standard" Java. Also, I consider it unlikely that any extension such as JSE or AspectJ will ever make it into Java proper.