generics and arrays and multi-class collections

S

Sherman Pendley

xen said:
My god, I hadn't even imagined that declarations could be so complex.

void (*signal(int x, void (*y)(int )))(int ) { }

But I'm sure they can be much, much complexer.

True, but let's be fair - C also has typedef, which lets you hide the real
complexity. I wouldn't want to imagine using pointers to functions without
typedefs.

sherm--
 
X

xen

True, but let's be fair - C also has typedef, which lets you hide the real
complexity. I wouldn't want to imagine using pointers to functions without
typedefs.

sherm--

True, that's probably what I'd use extensively, because my procedural
programming experience is mainly Borland Pascal (and Delphi), where
you have to 'typedef' almost everything if you want to use pointers,
like:

type
TMatrixPtr = ^TMatrix;
TMatrix = object
function transpose: TMatrixPtr;
// etc
end;

So, that's not really the point, or not all of it any way. Just all of
it together, the 'nature' of C, makes me want to avoid it as much as I
can. No amount of tricks or utilities or insight is going to change
that. Now my C experience is not much, just one assignment for a basic
client/server application in C, and a computer graphics opengl
assignment in C++. But I tend to immediately like or dislike a
programming language, and I've never found my likings to change.

xen
 
J

Jim Garrison

Roedy said:
Have a peek inside the source for ArrayList. You will see Sun could
not do it without suppressing warnings. I get the idea Sun is going
to redo generics, perhaps throwing out type erasure and dealing with
embarrassments like this.

Just read the language specification sections on Types. There
is at least one apology for generics being broken, with a 'promise'
to fix them in a later release, "after migration of existing code"
(see section 4.7 Reifiable Types). It is really hard to
do much with generics without @SuppressWarnings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top