POV-Ray : Newsgroups : povray.off-topic : Standard libraries : Re: Standard libraries Server Time
6 Sep 2024 19:21:52 EDT (-0400)
  Re: Standard libraries  
From: Darren New
Date: 7 Mar 2009 12:08:19
Message: <49b2aa03$1@news.povray.org>
Warp wrote:
>   Says the person who didn't even know how lambda functions will be
> implemented in the next C++.

Nonsense. The limitations of the undefined behavior tell me they're not 
going to be implemented by allocating the stack onto the heap, for example.

>   I like it how you succeed in making *everything* sound negative when
> applied to C++, while at the same time the *exact same thing* is positive
> in other languages.

Huh?

>   For example, generics in Java being "just syntactic sugar" is a positive
> thing, while lambdas in C++ being "just syntactic sugar" is a negative thing.

What makes you think the fact that generics in Java being syntactic sugar is 
a good thing? Where'd I say anything to imply that?

>> You can't have closures in a language without runtime type information.
>   Oh, now C++ doesn't even have RTTI. Right.

Cool. So you have a library capable of marshaling any type of data into a 
serialized stream? I can pass you a void* and you can inspect what it points 
to and tell me what class it is? The traceback in your exceptions can tell 
you what the values passed as arguments to the function on each frame... oh, 
wait, that's right...

Hell, you can't even tell me how big an array is, or look at a pointer to a 
value and tell me whether it's valid. How are you going to tell me what type 
it is?

>   Like "lambdas", what is called "RTTI" in C++ is not *really* RTTI, right?

It's limited in exactly the same way as lambda's are - you get just enough 
RTTI that people can call it RTTI, without having so much that you have to 
do something extreme in the runtime code to make it work.

>   I start seeing your general rule of thumb: Every programming language
> feature, when implemented in C++, either isn't *really* that true feature,

No, there's a bunch of stuff that C++ does decently, and a bunch of stuff 
like RTTI and lambdas that, yes truly, aren't really what everyone else in 
the world calls that feature.

> or is magically converted into a negative aspect of the language (while
> it's a positive feature in all other languages).

It's usually the combination of that feature with other features or 
misfeatures that make what's positive in some languages into what's negative 
in C++.

>>>> (2) not wanting to add any syntax for it,
>>>   Have you even looked at how lambda functions will be written in the new
>>> C++ standard? How is it not adding new syntax for it?
> 
>> A complete lack of any sort of keyword, like, oh, "lambda" maybe?
> 
>   Wow. The lack of a keyword is now a negative feature. Right.

Yes, because it makes it harder to read and parse. It's not like there isn't 
a whole theory behind parsing (for example) that just can't be applied to C++.

>>>   Good thing you are not prejudiced nor biased in the least.
> 
>> "Prejudiced" would imply that I'm not making judgements based on experience, 
>> but rather based on lack of knowledge.
> 
>   Are you seriously telling me that you did extensive research on the
> new lambda function feature as specified by the current C++0x standard
> draft before making your remarks?

No. I read what wikipedia has to say about it, and I understand how C++ is 
generally implemented in terms of a memory model, and from that I can deduce 
that unless you do something *very* extreme, you're not going to get lambdas 
out of the C++ mechanisms. The fact that the kinds of extreme things you'd 
need to do lead to undefined behavior tells me that people aren't going to 
do that, or at least won't be required to.

If I told you I had a great idea for C++, and all it needed was to allocate 
each stack frame on the heap as a linked list, and to then add garbage 
collection, wouldn't you tell me it's unlikely to be implemented by many C++ 
compilers?

>> I'm biased against ugly languages that are a pile of hacks to fix flaws in 
>> other hacks.
> 
>   At least you dare to admit it.

Sure. I've never hesitated to express my dislike of hacks, even when I 
recognise them as necessary hacks.

>>>> No. I just don't like C++.
>>>   And for that reason you have to constantly write prejudiced BS about it.
> 
>> It's neither prejudiced nor BS. What makes you think it's prejudiced?
> 
>   Because you write about a new language feature without even knowing how
> it will be implemented.

I know how it *won't* be implemented. It won't be implemented such that 
references to local variables survive the end of the stack frame those local 
variables are allocated in. That's enough.

Or do you think C++ is going to hoist those local variables into a separate 
object (like every other language implementing actual lambdas)? And if so, 
when does C++ deallocate that separate object, given there's no garbage 
collection?

>   I hope you have a good time laughing.

I did. I wouldn't be spending all this time typing if it wasn't amusing. 
Thanks for asking.

-- 
   Darren New, San Diego CA, USA (PST)
   My fortune cookie said, "You will soon be
   unable to read this, even at arm's length."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.