Article

From:
To:
Barry Kelly
Subject:
Re: Delphi Project X Cross GUI
Newsgroup:
embarcadero.public.delphi.non-technical

Re: Delphi Project X Cross GUI

Hello,

Barry Kelly wrote:

> Why you might want to use anonymous methods: if you want to delay
> evaluation of some kind, such as symbol table lookup, but not have to
> write some elaborate fixup or callback mechanism (and possibly need to
> worry about arguments). A simple list of closure references can work
> nicely here, with variable capture transporting the arguments.

it might be different in your case, but for the compiler I was working
on, the fixups were pretty straightforward (one additional pass after
compilation which simply swapped a few values), and using closures for
those fixups might have doubled or tripled the compilation time since
they were many. (Not to mention that I would have had to write a memory
manager first. <g>)


> Subclassing polymorphism isn't a Delphiism distinct from C++, but it
> is also very useful in compiler implementation, as any kind of
> interface encapsulation would be in any system broken up into
> modules. For example, consider porting a compiler across multiple
> different back ends or platforms: substituting different
> implementations of a common interface is far preferable to a liberal
> sprinkling of #ifdefs and alternating linker command lines, relying
> of linker resolution for different implementations of the same
> symbols, but without the type safety.

Again YMMV, but something like EmitMove(a,b) being a /virtual/ method
would have impacted performance perceptibly in my case.


> On the other hand, I see templates beyond generic data structure
> definition and traversal of relatively little sensible use.

Templates make it possible to have a polymorphic EmitMove(a,b), without
dirty linker tricks and without a virtual function call :) I rarely opt
for static template polymorphism in everyday programming, but I think
it has its uses when performance is critical.


> Pattern matching in the style of a functional language, or automatic
> support for type equality and memoization, or garbage collection, on
> the other hand, would provide large advantages for compiler
> implementation over and above either Delphi or C++.

I don't know about the performance aspects of those (and it seems that
for DCC, performance is highly critical), but I'd certainly agree that
modern functional languages would allow for much more /elegant/
compilers than the classic procedural approach, and that isn't specific
to compilers.

-- Moritz
"Hey, it compiles! Ship it!"
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Mon, 25 Nov 2024 11:34:41 UTC
Copyright © 2009-2024
HREF Tools Corp.