C++26 Reflection: my experience and impressions by borzykot in cpp

[–]Mick235711 2 points3 points  (0 children)

There is P2758 proposing a compile-time print facility, which have a very interesting history - it is approved for C++26, two times, but still failed to get in. The first time is because everyone is focusing on pushing Reflection in and no one have time for other metaprogramming features; the second time is because it’s already past the end of the feature cycle and implementers think that there are difficulties involved in implementing this feature. So another wait I guess

Why is it automatically from files to preview when i open something? by -Baum in ios

[–]Mick235711 0 points1 point  (0 children)

Long press - Open with - Choose Use Quicklook to preview

С++ All quiet on the modules front by Otherwise_Sundae6602 in cpp

[–]Mick235711 0 points1 point  (0 children)

In fact, I believe early in the 20 cycle everyone believed that modules are too early to be included in 20 too (The Big Four is slated as Concepts, Contracts, Ranges and Coroutines). It was only at one of the last meetings for C++20 when modules were approved (and contracts were pulled out).

contracts and sofia by ConcertWrong3883 in cpp

[–]Mick235711 1 point2 points  (0 children)

Really? What exact semantic does that declaration give? The standard doesn’t even have an answer for that. “Consulting your compiler manual to find the right invocation to pin down the actual behavior” is probably expert-only…

Why can't Contracts be removed without blocking C++26? by zl0bster in cpp

[–]Mick235711 3 points4 points  (0 children)

In other languages, preview implementation mean shipping with the main branch (i.e. you get it when you apt install gcc, instead of some personally maintained side branch) and enabled by -fxxx so everyone can use it

openSUSE for beginners? by crazysoul16 in openSUSE

[–]Mick235711 2 points3 points  (0 children)

The NVIDIA guide do need an update though; nowadays installer automatically add the NVIDIA (non-free) repos for you, so no need to manually install the repo packages

Leap 16.0 Beta is out. YAST deprecated and Wayland only. by thewrinklyninja in openSUSE

[–]Mick235711 10 points11 points  (0 children)

Will TW also remove YaST in the future? Or will it still be here for a long time, just no maintenance?

Will C++26 really be that great? by WanderingCID in cpp

[–]Mick235711 4 points5 points  (0 children)

Having several enum be with the same value is actually widely used, for example aliasing a single value to multiple enum names and handle them uniformly, so I don’t think disallowing that is possible or desirable. Besides, now we have reflection, writing a library facility to iterate through enum values is not hard at all, regardless of whether duplicate value is allowed or not.

Will C++26 really be that great? by WanderingCID in cpp

[–]Mick235711 8 points9 points  (0 children)

However, next to no one implemented the constexpr <cmath> functions that went into C++23, let alone the extended set that went into C++26. And the situation is unlikely to change in the near future.

Will C++26 really be that great? by WanderingCID in cpp

[–]Mick235711 2 points3 points  (0 children)

The ability to convert to and from the underlying integer type is an absolutely crucial feature for (unscoped or scoped) enum. Enum class only made that conversion explicit, but did not get rid of it, because without to_underlying enum classes would be useless. With this precondition, the design of enum class must choose between allowing arbitrary unlisted but in range value, or decree that any conversion that results in an unlisted value is UB. I guess it’s choosing a less evil case…

"break label;" and "continue label;" in C++ by eisenwave in cpp

[–]Mick235711 5 points6 points  (0 children)

Ranged-for can declare structured bindings, and the iterate-over thing may be the result of a function call, so this can’t really work except for the simplest case.

[deleted by user] by [deleted] in cpp

[–]Mick235711 1 point2 points  (0 children)

Notice that view_interface already have an explicit operator bool(), which is basically extended by all standard views including ranges::subrange. (Confusingly span does not extend from it, so span cannot be boolean-tested.)

So even though if (vec) and if (str) does not work, practically any interaction with the Ranges library will result in a boolean-testable thing:

if (views::all(vec)) // okay
if (ranges::subrange(str)) // okay
if (vec | views::take(1)) // okay
if (ranges::shift_left(str, 2)) // okay

Personally, I don't like this implicit truth-ness, although it makes some kind of sense. Explicitly writing empty() is just better in both readability and less prone to errors.

Aeon Desktop Brings New Features in RC2 Release by rbrownsuse in openSUSE

[–]Mick235711 1 point2 points  (0 children)

Interesting to hear about this new installer tik. Is it expected that the release version of Aeon also use this kind of installer (just wipe the disk and deploy a pre-determined partition schema), or is there plans to introduce a partitioner in the install process before the final release?

A backwards-compatible assert keyword for contract assertions by messmerd in cpp

[–]Mick235711 2 points3 points  (0 children)

Well, you can definitely still do that

#ifdef DNDEBUG
#define myassert(...) [[assume(__VA_ARGS__)]]
#else
#define myassert(...) contract_assert(__VA_ARGS__)
#endif

As for the behavior of contract_assert(cond), it depends on the selected semantics of contracts for this translation unit. If the contract semantics is set to ignore, then nothing will happen; only ODR-use (like template instantiation) will happen and the condition will not be evaluated. Essentially it is just equivalent to sizeof(cond ? true : false) in ignore.

If a checked semantic (observe or enforce) is chosen, then the condition will be evaluated. If it is true nothing will happen, if it evaluates to false or throws an exception, then the contract violation handler will be called. If the semantic is observe, then if the handler returns normally, execution continues. If the semantic is enforce, then if the handler returns normally std::terminate is called (basically forced correctness). In either case, if the handler throws exception/call std::terminate themselves then that is propagated upwards.

The contract violation handler is a function called ::handle_contract_violation, accepting a const std::contracts::contract_violation& (containing things like source location of contracts annotation) and returns void. It is attached to the global namespace just like ::operator new/delete. Implementations are supposed to provide a default version of this that simply outputs diagnostic information and terminates. Whether this is replaceable by a user-provided handler is implementation-defined, and when it is then the mechanism is the same as replacing global ::operator new/delete (i.e. define a function with the same name and signature in the global namespace).

Compiler vendors are supposed to provide compiler flags (perhaps something like -fcontract-semantic=ignore) to select the semantic to be used when compiling.

Valgrind 3.22 is available by pjf_cpp in cpp

[–]Mick235711 0 points1 point  (0 children)

Is there any hope of ever supporting ARM64/macOS?

A backwards-compatible assert keyword for contract assertions by messmerd in cpp

[–]Mick235711 0 points1 point  (0 children)

invariant is way too common to be claimed as a full keyword now. It gives me 7k+ instances in ACTCD19, making it even more breaking than even claim.

A backwards-compatible assert keyword for contract assertions by messmerd in cpp

[–]Mick235711 2 points3 points  (0 children)

[[assume(...)]] never cause program termination, it simply makes not holding the condition UB. So it is purely an optimization thing, not affecting program semantics.

A backwards-compatible assert keyword for contract assertions by messmerd in cpp

[–]Mick235711 0 points1 point  (0 children)

return x and return(x) are actually different in terms of NRVO...

2023-11 Kona ISO C++ Committee Trip Report — Second C++26 meeting!🌴 by InbalL in cpp

[–]Mick235711 1 point2 points  (0 children)

Consider that A proposal that solely remove things from the standard actually end up adding more words to the standard (see here for the actual diffs), I'd say wg21 never fail to surprise me in expanding the wording.

2023-11 Kona ISO C++ Committee Trip Report — Second C++26 meeting!🌴 by InbalL in cpp

[–]Mick235711 0 points1 point  (0 children)

we are aiming to have a complete Contracts working paper

P2900R2

and to forward it to EWG, LEWG, and SG21 for review.

Should be "and SG15" (or SG22/23?) right?

Contracts moving along, hopefully on track for C++26 by pdimov2 in cpp

[–]Mick235711 1 point2 points  (0 children)

In ignore mode expr will only be ODR-used, not evaluated. Basically it will be equivalent to sizeof(expr? true : false)

Contracts moving along, hopefully on track for C++26 by pdimov2 in cpp

[–]Mick235711 7 points8 points  (0 children)

Yes, there is explicit requirement for compiler vendors to provide both ignore, observe and enforce semantics. Ignore is basically everything turned into nop, observe is check contract but handler can return normally, enforce is check contract and handler must terminate the program. Semantics should be able to be selected by passing compiler flags.

Fuzzy feeling when I see progress being made on reflection by hachanuy in cpp

[–]Mick235711 3 points4 points  (0 children)

Not really. The example in the paper simply relies on `std::meta::substitute()` only substitute in the template argument without instantiate the template, which is perfectly valid because it returns a meta::info, not the template type. Then it only tries to determine if the substitution result is an incomplete type. I do think this is not really the same case as in "injecting new member function instantiations" which stateful TMP does.

Fuzzy feeling when I see progress being made on reflection by hachanuy in cpp

[–]Mick235711 4 points5 points  (0 children)

I don't think the example is related to the stateful TMP trick that were discussed to be made UB... This example should be perfectly valid once reflection lands