Sunday, December 11, 2022

Digest for comp.lang.c++@googlegroups.com - 10 updates in 5 topics

"Alf P. Steinbach" <alf.p.steinbach@gmail.com>: Dec 11 12:29AM +0100

On 10 Dec 2022 22:52, Ben Bacarisse wrote:
 
> That strikes me as a very strange opinion, but is there any point in us
> (you and I) examining it? In my experience, investigating that sort of
> opinion, expressed in that style, is rarely fruitful.
 
Example.
 
class Holder
{
using Variant = variant<
// possible types here
>;
 
Variant m_variant;
 
public:
template< class Type >
Holder( in_<Type> e ): m_variant( e ) {}
 
template< class Type >
auto holds() const
-> bool
{
// TODO: optimize via compile time decisions (type lists).
const auto is_specified_type = []( const auto& e ) -> bool
{
return are_derived_and_base_< Unref_<decltype( e )>,
Type >;
};
return visit( is_specified_type, m_variant );
}
"daniel...@gmail.com" <danielaparker@gmail.com>: Dec 10 03:39PM -0800

On Saturday, December 10, 2022 at 10:29:59 AM UTC-5, Christian Gollwitzer wrote:
 
> > auto foobar = someFunction(a, b);
 
> why do you need to know the type of foobar in thie -
> s case?
 
Minimally, you need to know whether someFunction returns a proxy, if it does,
you don't want to use auto. Functions returning proxies aren't that rare in
C++, matrix libraries such as Eigen use them extensively, and there's
even one in the standard library.
 
> This has never be a big problem when writing Python code
 
But Python is a more coherent language than C++.
 
Daniel
Andreas Dehmel <blackhole.8.zarquon42@spamgourmet.com>: Dec 11 02:37PM +0100

On Sun, 11 Dec 2022 00:29:26 +0100
> };
> return visit( is_specified_type, m_variant );
> }
 
Not sure whether you're arguing for or against, but
auto function(...) -> bool
can only be a bad joke and is_specified_type() is basically a bog
standard template function that thinks all the cool kids are using auto.
 
 
 
Andreas
David Brown <david.brown@hesbynett.no>: Dec 11 04:42PM +0100

On 10/12/2022 14:48, Andreas Dehmel wrote:
 
> Like I wrote, my position is that adding _any_of_ "const", "*" or "&"
> to auto is doing it wrong. It's just trying to hide the fact that you
> actually want a specific type but are too lazy to write it down.
 
When someone writes "const auto &elem", they are saying the details of
the actual type are not vital to the working of the code - but it /is/
important that the variable is "const" and a reference, giving efficient
read-only access.
 
It is emphasising and being explicit about the important aspects while
neatly omitting unimportant (for the code in question) details.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Dec 11 02:31PM -0800

On 12/8/2022 4:31 AM, Juha Nieminen wrote:
> who is reading the code, is that it hides the type in question. When
> you see something like:
 
> auto foobar = someFunction(a, b)
 
[...]
 
Indeed. I find myself instantly looking for the declaration of
someFunction so I can make a note... foobar = a pointer to foobaz.
Gunnar Heaney <gunahean@gmail.com>: Dec 11 11:47AM -0800

This is the PDF eBook version for Cleveland Clinic Illustrated Tips and Tricks by Steele
(Download link for cheap price) https://booksca.ca/library/ebook-cleveland-clinic-illustrated-tips-and-tricks-by-steele/
David Brown <david.brown@hesbynett.no>: Dec 11 12:28PM +0100

On 09/12/2022 22:34, Scott Lurndal wrote:
 
>> Most of the consumer devices out there run java now.
 
> Actually, most of them run linux (android) with a application layer api (Dalvik)
> that provides similar functionality to Java. Or they run IOS.
 
I thought the trend now was to use Kotlin rather than Java. It runs on
the same kind of Java VM, but it's a different language.
David Brown <david.brown@hesbynett.no>: Dec 11 04:38PM +0100

On 10/12/2022 06:43, Bonita Montero wrote:
>> bases for the assertion.
 
> There are not much desktop or server applications in Java which
> come along with a redistributed VM.
 
There are lots of desktop apps that come with their own Java VM. It
seems quite common for big apps. For example, Eclipse is usually
distributed with a Java VM. Since Eclipse is the standard for embedded
development IDE's and tools from microcontroller manufacturers, I have
dozens of Eclipse installations for Linux and Windows, each with their
own Java VM.
 
While there seems to be a common core to Java VM's that is fine for many
programs, others are fussier about versions or different VM
implementations - and thus distributed them with the programs.
David Brown <david.brown@hesbynett.no>: Dec 11 12:18PM +0100

On 09/12/2022 21:50, Tim Rentsch wrote:
 
> In English there is a significant difference between "early" and
> "premature". (It hadn't occurred to me that premature might be
> derived from mature.)
 
The etymology of "mature" is from a Latin word for "ripe" (such as "ripe
fruit"). So it has implications of stages of ageing, unlike "early".
"Premature" is therefore "before the fruit is ready to eat", and thus
very different from merely being "early". It's often a good idea to do
things "early" - it is rarely a good idea to do them "prematurely".
 
If a language does not have a word corresponding directly to "premature"
(or if the word carries too strong connotations of "premature baby"),
then the equivalent of "too early" is going to be a far better
alternative than merely "early" in Knuth's quotation.
"gdo...@gmail.com" <gdotone@gmail.com>: Dec 10 03:41PM -0800

is import working in g++ or clang++ yet
 
import <iostream>;
 
int main()
{
 
int answer { 42 };
 
std::cout << "The answer to life, the universe, and everything is "
<< answer
<< std::endl;
 
return 0;
 
}
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: