Re: Hashing and comparing of arrays

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance





Ole Nielsby wrote:

The compiled code for the three ran at *almost* the same
speed! I was especially impressed with the CPS-rewrites
done by the optimizer.

Sounds interesting. My interpreter port will have to be done
in Continuation Passing Style, as the current version (written
in NASM) does things to the stack that simply won't work
with clr stack frames (like piped list processing, and a construct
that works like a mix of structured exception handling and
explicit tail call - this may sound obscure but the construct is
quite central to the language and models the concept of "taking
responsibility", which is of great help when debugging.)

Interesting, have you got any intros/docs/references on any of this?

My main reason for picking C# for the project is, I like the
idea of getting verifiable code "by default" - though I'm
not sure this is possible when WeakReference is involved.
However, if the C++ compiler can produce better optimized
and still verifiable code for the style I will be using (or if I
can't get verifiable code with WeakReference in it), I might
change the horse.

Which definition of "verifiable" are you referring to? verifiable, as in
"no-null-pointer derefs" or "no-undefined-behaviour", or ...

BTW I explored C# generics and found that there were things
I'd like to do but couldn't, some of which I think would be

You can't really do meta-programming with C# generics -- they are not
touring-complete like c++ templates ;) At a point i was quite fascinated
with meta-programming using templates. In the end a realized that it's
just building another *very* poor language, and that I was hard put to
identify problems in my problem-domains which had significant
performance-benefits from it.

Many of the tricks done with templates in C++ is all about letting the
compiler know as much as possible about the types of arguments to allow
more precise analysis and inlining, which may cause increased
performance and almost certainly bloat, and often a long-lasting
sessions of "spoon-feeding-the-compiler".

Many of the things i did with static-dispatch a few years ago I do with
dynamic dispatch (virtual functions or dictionary-lookup) now.

possible with C++ templates, though I'm not too sharp with
templates (no pun inteded) - actually, I shocked a C++ expert
the other day by casually referring to C# generics as "templates".

Generics are certainly not templates. Templates is "type-parameters by
macro". Generics is "limited type-parameters, mostly at compile-time".

precisely how C++ templates relate to C# generics. Do they
merge, in the sense that the C++ compiler will use the clr
generic whenever possible and resort to code bloat when
not... or are they rather separate concepts?

I don't have any answer to that, but I can't imagine how the C++
compiler could share code between all instances of classes or functions
that are parametrised with reference-types, like C# does.

--
Helge Jensen
mailto:helge.jensen@xxxxxxx
sip:helge.jensen@xxxxxxx
-=> Sebastian cover-music: http://ungdomshus.nu <=-
.



Relevant Pages

  • Re: Delphi to Visual Studio Conversion Project
    ... Templates are in fact really compiled at the moment they are used. ... what the constraints specify, i.e. you can only cast the type to ... When you compile the generics, all the capabilites are already tested ... compiler checked before use. ...
    (borland.public.delphi.non-technical)
  • Re: Delphi to Visual Studio Conversion Project
    ... Yes: constraints. ... Templates use some kind of duck typing. ... When you compile the generics, all the capabilites are already tested ... compiler checked before use. ...
    (borland.public.delphi.non-technical)
  • Re: Hashing and comparing of arrays
    ... My interpreter port will have to be done ... and still verifiable code for the style I will be using (or if I ... templates - actually, ... the other day by casually referring to C# generics as "templates". ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... This can be implemented mostly with templates. ... and allow the compiler to discard or memoize ... > I think I prefer Ada generics. ... Most of these "implementation defined" parts are there for portability. ...
    (comp.lang.cpp)
  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... This can be implemented mostly with templates. ... and allow the compiler to discard or memoize ... > I think I prefer Ada generics. ... Most of these "implementation defined" parts are there for portability. ...
    (comp.lang.ada)