Re: Language features for compiler writing was: Java compiler courses

Hans-Peter Diettrich <DrDiettrich1@aol.com>
27 Apr 2007 14:35:01 -0400

          From comp.compilers

Related articles
Java compiler courses wookiz@hotmail.com (wooks) (2007-04-20)
Re: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-23)
Re: Java compiler courses torbenm@app-7.diku.dk (2007-04-26)
Language features for compiler writing was: Java compiler courses cfc@shell01.TheWorld.com (Chris F Clark) (2007-04-27)
Re: Language features for compiler writing was: Java compiler courses torbenm@app-2.diku.dk (2007-04-27)
Re: Language features for compiler writing was: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-27)
Re: Language features for compiler writing was: Java compiler courses la@iki.fi (Lauri Alanko) (2007-04-28)
Re: Language features for compiler writing was: Java compiler courses jon@ffconsultancy.com (Jon Harrop) (2007-04-28)
Re: Language features for compiler writing was: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-28)
Re: Language features for compiler writing was: Java compiler courses danwang74@gmail.com (Daniel C. Wang) (2007-04-28)
Re: Language features for compiler writing was: Java compiler courses s.r.clarkstone@durham.ac.uk (Simon Richard Clarkstone) (2007-04-29)
Re: Language features for compiler writing was: Java compiler courses torbenm@app-5.diku.dk (2007-05-04)
[1 later articles]
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers,comp.lang.functional
Date: 27 Apr 2007 14:35:01 -0400
Organization: Compilers Central
References: 07-04-074 07-04-084 07-04-109 07-04-125
Keywords: Java, OOP, design
Posted-Date: 27 Apr 2007 14:35:01 EDT

Chris F Clark wrote:


> You can get polymorphism, by using C++ as your C...
> That leaves GC...


I don't know whether polymorphism is a requirement for writing
compilers, some opinions deny just the requirement of OOP.


About GC, it can come in handy, but IMO if you don't care about memory
(leaks...), you don't need it, and if you care, you shouldn't use it ;-)




> Here is the point I want to debate/discuss. What C and its semantic
> (if not syntactic) cousins Pascal and PL1/G have is the ability to
> create a modify complex graph structures (with complex vertexes and
> edges) in place (i.e. by side-effect). (This ability exists in all
> languages where one can explicitly manipulate pointers and not just
> lists.)


I prefer to distinguish between pointers and references, as C++ does.
Pointer arithmetic is dangerous, references are a requirement for OOP,
and are safe unless referenced objects are erroneously destroyed.
Leaving the destruction to GC is not a replacement for proper object
management ;-)


I think that we don't need another discussion of my ;-) opinions.




> So, this is the question, is there an FP technique that allows
> inidividual elements of an array (list, bag, someother roughly
> equivalent structure) to be addressed and arbitrary (i.e. cyclic)
> graphs to be constructed (and rearranged) on-the-fly, but where
> unreferenced elements get collected? If so, where can I learn about
> it?


Such a usable techique just is mark-sweep. Where "traditional" garbage
collection must know about the location of references, in your
index-based model it must know about the location of indices. In all
cases RTTI is a requirement for GC, and type safety at least is desireable.


One variation of GC uses reference counting for the determination, when
an object becomes unused. This model has some problems, e.g. with
circular references, but it can be implemented even without RTTI
support, and can be made work also with cyclic references.


Literature? Sorry, I cannot recommend specific literature. The
documentation of the Boehm GC may contain some helpful information.
Reference counting should be self-explanatory...


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.