« first day (2782 days earlier)      last day (2170 days later) » 

12:22 AM
I think because it uses the registry to setup the dev console
and 2 copies of cl.exe conflict with each other
 
So, the Window's registry was a bad idea, right, compared to just settings in files, right?
 
they assumed that no-one would ever want 2 separate installations of their dev env
 
What if the real reason is that Microsoft has a dysfunctional corporate culture where new productive development ends up being prioritized over maintaining critical infrastructure? For example, instead of fixing problems in MSVC they're writing that bullshit Electron based IDE.
Curiously, they already rewrote their installer with much fanfare but fucked up the part where they decoupled the graphical IDE from version of CL.exe
 
 
2 hours later…
2:19 AM
is there anyways to upgrade python 2 to python 3 and automatically updates all the lib associated with it?
 
 
3 hours later…
4:52 AM
Design a terrible language itself is understandable, but design a terrible language after hundreds better ones have been made is just ... slightly retarded ...
 
 
1 hour later…
6:20 AM
> Polymorphic mono-traversable
ah yes, the ever elusive polymorphric monomorphic traversable
 
6:48 AM
Is the Haskell meme loosing steam? Few developers I knew using it were working for sass startups, on boring projects that weren't technically challenging. Except they decided to use Haskell.
But I haven't spoken to anybody using Haskell since 2016
 
nwp
@TelKitty Try 2to3.
 
@Mikhail That is fixing problems (in VS, not MSVC). VS is so full of legacy COM crap it is unfixable.. they pretty much had to start VS Code to get anywhere.
 
@Puppy Except that COM isn't legacy. Very popular with hardware device manufactures. Also certain ways to communicate with the Windows shell require COM, for example drag and drop functionality.
BUT you might be right in the sense they probably could justify VS Code as a way to get new customers with the secret dream of fixing VS. I think we've heard many horror stories about MS work culture.
 
apart from the fact that COM is very legacy and if anything, hardware device manufacturers using it proves it rather than disproves it
the real problem is that the interfaces they're exposing over COM are totally fucked.
 
You don't buy the argument that if certain interaction with the Windows shell can only be done over COM that means its not legacy?
Its certainly exposed to the user in a legacy style
 
7:02 AM
of course I don't, that just means that it's a legacy usage of a legacy technology that they haven't replaced yet
 
Windows is legacy?
 
no, COM
 
🤔
 
At least we both hate COM
 
7:34 AM
Morning ^^
 
 
1 hour later…
9:02 AM
@Ven I’ve had issues where my grammar needs to make(…some data…) to propagate info around (e.g. zero-width lookarounds which can't capture anything, like <next-level> yesterday), which can interfere with the data I set in the actions; does that ring a bell? I can sketch a demo if you want
 
Ven
@LucDanton Did I not mention dynamic variables yesterday? :P
 
yeah, I was wondering about that
 
Ven
Tu coq, filippe.
 
anyhoo I set the info with a custom remake($/, :$info) which does ye olde hash merging (into $/.made)
 
Ven
learn to love :my $*foo;
 
9:05 AM
@Ven 🐓
@Ven I actually had a lexical hack before I figured out I was overwriting .made!
 
11
Q: What does the dot before a postfix or postcircumfix in Perl 6 mean?

chenyfIn the Perl doc, there is a section about .postfix/.postcircumfix, it says that In most cases, a dot may be placed before a postfix or postcircumfix: my @a; @a[1, 2, 3]; @a.[1, 2, 3]; # Same Technically, not a real operator; it's syntax special-cased in the compiler. I tried myself: >...

Perl being Perl
> An expression in Perl 6 is parsed as termish things with infixish things between them. A termish is in turn defined as zero or more prefixish things, followed by the term itself, followed by zero or more postfixish things. [...]
 
@Ven I dunno, a hash merging function is helpful one way or the other IME and once I have that remake comes for free; why not decorate the AST properly if using actions, isn't that the point?
 
I'll take "circumcised" for $200
 
Ven
@LucDanton depends where you want propagation really
@sehe Vocabulary is cute but it's pretty much what every single language does, so...
 
> %(hello => 'world').map({ .<hello> })
(world)
@sehe
 
9:09 AM
@Ven The vocabulary is exactly the point.
 
Ven
@sehe oh no, not words
 
@Ven oh then I get your meaning; it’s really not the sort of parsing I’m doing today, but who knows what the future will have in store :)
 
Ven
@sehe if I s:g/ish<|b>//; will you feel better?
 
@LucDanton why is that .<hello> and not .hello? Did they have interpunction on sale?
(I'm speaking out of ignorance, only because I know you can cure it and you know my language leanings already)
 
Ven
@sehe Perl 6 doesn't do JS-style barewords access.
 
9:12 AM
@sehe %foo<bar> is one syntax (via a postfix op) for associative access, %foo.bar is method call
 
@Ven Yes. You know why? Because there's a very specific reason Perl chooses the "-ish" vague-naming. They explicit like to make things ambiguous, interchangeable etc.
Of course this gives rise to exquisite poetry, but the flipside is that poetry is often cryptic.
@LucDanton Ah. I forgot that %(hello => 'world') as a hash literal. I've been doing too much javashit this morning
@Ven ^
 
Ven
@sehe
 
@sehe say, do I keep cc-ing you for Perl 6 things?
> <next-level($level)> {} :my $next-level = $<next-level>.made<next-level>;
looks a bit silly
 
@LucDanton Oh yeah why the hell not :) It does tickle my fancy. Just know that I'll likely never invest the time to get critical mass with my Perl6 skillset
 
Ven
I tend to not refer to made in parsing, at all
 
9:18 AM
@Ven I didn’t until I had the zero-width lookahead, and I still use the normal capture mechanisms otherwise
 
Ven
@sehe Oh, I get the idea: you really only need a single C++ in a lifetime.
 
@Ven Well. You "asked" (by implying I panic over nothing but wordish things)
@Ven Basically.
 
> <?{(!$<overline> || $<overline> eq $<underline>)
e.g.
 
Ven
@sehe I think you mustn't look too deep into words that are used internally by the parser.
Because only the implementors will care about that. Otherwise you'll spend the next 20 years criticizing the parsers of every single language you use.
 
Stockholm Syndrome, but monogamous
 
Ven
9:20 AM
 
I absolutely glossed over the Q/A
 
33s -> 20s -> 14s... optimizing algorithms with numpy works but it's slow .__.
 
Ven
throw more algorithms at it
 
Time to meta-optimize
 
I decreased the running time of one part of the algorithm from 12s to 0.02s
 
Ven
9:24 AM
You must construct additional algorithms.
 
Iterating over numpy arrays is better than indexing, but not iterating is even better
 
@Morwenn Lol
 
nwp
Did another part of the algorithm increase the running time by 11.98s?
I can totally subtract 2 numbers.
 
Wow. Politician's genes
 
@nwp nope, it went down from 20.5s to 14s and now totally dominates the running time
it's a big loop, so of course it's not the most efficient thing in the world
 
Ven
9:26 AM
but C is fast so loops must be fast
 
numpy is partially written in python so ...
 
Ven
thanks for your contribution.
 
tbh reasonning about whether it will be fast would have been easier in C xD
 
also big loops usually have room for optimization unless you have already done so
 
9:28 AM
Ven 4 troll of the year award!
 
actually my fastest solution still indexes but unless there's been a fuckup somewhere it should only index dozens of elements max instead of millions of elements, which sounds reasonable
 
Ideally we could inline C++ into our python code
 
ok, just made sure that the running time would be bad instead of terrible in should-never-happen pathological cases
 
nwp
@Mikhail Other way around. Just put the python interpreter in a constexpr block and let the compiler optimize out all the python.
 
@Mikhail For someone who likes to moan about the pitiful state of things a lot, you have a pretty weird vision of what "ideally" looks like
 
9:38 AM
people who suffer a lot tend to compromise :x
 
Rewriting hot spots in a more optimal language is a rather mild proposal
I'm also battling my own python demons, almost done refactoring a large python code base (~10k lines). Perhaps I'll write some tests...
New 'typing' features since Python 3.5 really helped
 
I find the new typing features mostly nice for IDE autocompletion :p
And documentation
 
10:04 AM
They gotta fix the ternary operator in python so that it looks like the one in c++
 
Speaking of which there are several proposals to improve the ternary operator in C++
One proposes to make it overload (because it can somehow be improved for std::simd)
Another one proposes it be allowed in fold expressions
 
Maybe helps with maybe_modified= some_condition ? : 42 : maybe_modified, this used to be the better way to write if statements in a tight loop
 
template <std::size_t... is>
T test_impl(std::size_t j, std::index_sequence<is...>)
{
    return ( (j == is) ? f<is>() : ... : throw_range_error<T>() );
}
 
10:23 AM
@Ven I wanted an empty hash so I wrote %() but I was in a scope with $/ :(
 
Ven
@LucDanton yup...
write :{}
it's a cute emote
 
this is proper horrific cc @sehe I think I was unfazed by all the syntax until now
 
Ven
(I mean {} works as well but isn't an emote)
Yeah. Perl 6 got sigils and flattening totally wrong.
 
@Ven fry.jpeg are you saying you wanted more, or less flattening?
 
Ven
Also sharing {} for blocks and hashes is a mistake a few too many languages make...
@LucDanton Either. It doesn't disturb me in P5, where flattening is more present. And it doesn't disturb me in languages where it doesn't exist...
 
10:26 AM
indeed, hence my reliance on %(…) (we talked about this before of course)
 
Ven
{;_;}
 
@Ven a strange stance to take, if you don’t mind my saying; did you mention sigils because you think the same as well?
le luc entre deux chaises, comme on dit
2
 
Ven
si gîlles me dit qu'il aime bien ça
 
mdr
 
Ven
@LucDanton I dislike both, really. Itemization sucks, conflating values with single-item lists is stupid.
 
10:30 AM
I properly dislike scalars (without having a strong opinion on sigils per se) and I’m worried I’ll start defensively de-containerising everywhere
right
there’s something about certain languages where they implement some of their features with what I call a compiler writer’s mindset, which I think is heavily harmful although sadly I find it very hard to formulate why---other than the fact that most users will not be compiler writers
e.g. I get that one might want to have their language support my $foo = "hello"; $foo = "world";, but the way Perl 6 goes about it has so many terrible knock-on consequences
 
Ven
@LucDanton Perl 6 folks will often talk about "torturing the implementor"
@LucDanton mh¿
 
I’ve seen that, but maybe I don't get it: I’m fine with putting a burden on the implementer, my concern is about surface (aka visible to the user) consequences
@Ven i.e. I get that the variable/object/value thing is complex in light of (im)mutability, but I still don’t like Perl 6 scalars
 
Ven
@LucDanton it's supposed to be the opposite of what you think is heavily harmful: Always think of something as for the user.
@LucDanton but being able to type (true ? $a : $b) = 1; is so important rolls eyes
 
@Ven is it? maybe I didn’t get my point across
 
Ven
@LucDanton Or maybe they didn't :P.
 
10:39 AM
like I’ve said I find it hard to formulate, which is why I haven’t really talked about it before
it’s one of the reasons I’m put off by D, e.g. the whole delegate/closure deal
 
Ven
blitting ftw
 
if you have to talk about environment pointers to explain why a given language feature cannot work the way the user thought it would, there’s a deep, deep problem in the way you conceived that language
@Ven does that one really stand out for you? what do you think of Rust :)
 
Ven
@LucDanton Rust is the greatest thing ever created, obviously.
@LucDanton string is null, too.
@LucDanton I think "work the way the user thought it would" is... a bit of fallacy
 
@Ven for this particular case my view is that closures should really be closures
 
Ven
@LucDanton C'est genre, ton opinion, d'où-de.
 
10:44 AM
it is indeed
@Ven what was that in reference to?
 
11:07 AM
@Ven right now I write e.g. remake($/, my-info => 42); can I be cute and have the $/ be supplied under the covers aka just like make? it looks like make itself uses nqp magic, so I was wondering
there’s the augment way I suppose
 
@LucDanton this, basically. I mean, in c++ you get all these opportunities to shoot yourself in the foot, but rarely at the syntax level (inb4 Vexing and "uniform" initialization)
 
idk, I feel like it’s really the first time I ran into a syntax-level surprise like that
incidentally and I think I’ve said it before, C++ is not really the standard by which I judge things
 
That's what makes it fun! If things are worse than the average C++ syntax situation, it's against the Geneva convention
 
I don’t think (for now) that Perl 6 has worse syntax traps than C++ does; though I won’t comment on whether it has better or worse syntax cos that’s so opinionated
 
Ven
11:54 AM
@LucDanton Dlang
 
I don’t think I’m familiar with that one
 
Hey there
Is anybody here as experience with binary search?
 
std::lower_bound you're welcome :p
 
@Ven how convenient to have this and this while having nil results for non-matches! cc @sehe
 
Ven
12:14 PM
@LucDanton Cool.
 
@Ven I was actually disappointed
 
Ven
@LucDanton I was actually punning.
 
lol
Cool is so lame that it was the furthest thing from my mind
 
Ven
I'm surprised list is on Any and not on Cool.
yet another thing that's really not necessary sigh
 
@Ven speaking of, do you know of a use of list as opposed to List or vice versa?
 
Ven
12:20 PM
@LucDanton in this case, no. In general, method names starting with a caps means it's a coercer.
 
I was wondering about nodality tricks
 
Ven
yes?
 
idk it’s the only visible difference between the two, I figured it has to be for something
 
Ven
@LucDanton well, not in this case I think.
> say ((1.0, "2", 3e0), [^4], '5')».list
((1 2 3) [0 1 2 3] (5))
> say ((1.0, "2", 3e0), [^4], '5')».List
((1 2 3) (0 1 2 3) (5))
here is a case where it makes a difference:
> say [[1.0, "2", 3e0], [^4], '5']».List
((1 2 3) (0 1 2 3) (5))
> say [[1.0, "2", 3e0], [^4], '5']».list
([1 2 3] [0 1 2 3] (5))
 
cool good find
 
12:55 PM
Yay, I managed to numpy-optimize the algorithm to run within 1s /o/
which means that it's currently better for a 77Mo file than it used to be for a 2Mo one
 
1:31 PM
People arguing that to differentiate type concepts and value concepts we could have for example Arithmetic and ArithmeticValue
With adjective syntax the second could have been Arithmetic auto which isn't longer than adding Value x)
(but the first would have Arithmetic typename, agreed)
 
Ven
clearly we need to make concepts with a postfix ^
(really, only to piss off C++/CLI users. Oh wait, they're stuck in '98)
 
xD
 
Ven
.oO( Clearly PHP pioneered the correct solution: prefix all variables with $ )
 
nwp
And here I thought std::is_same_v should be replaced by ==.
 
@nwp You'll probably like P0844
 
nwp
1:38 PM
That's pretty neat.
 
I may be discussed in a few days
 
nwp
Next step: Remove all restrictions from constexpr.
Also make void f(auto p); work. I think there is an old proposal for that already.
 
goto is still banned in constexpr functions x)
 
Ven
motion to ban goto
@Morwenn lol so they went and did it
 
which means that libc++ will have to rewrite its std::nth_element implementation once it is required to be constexpr x)
 
Ven
1:44 PM
wait what
seriously?
 
I know, I stole it two days ago
 
Ven
@Morwenn I'm not sure if I'm amazed or...
inb4 template<auto typename>
inb4 template<typename_or_type? T>
HAHA THEY WANT TO ADD NON-BOOL CONCEPTS I KNEEEEEEEEEW IT
 
I didn't really read the proposal, too innovative, I'll wait to see whether it's rejected at its first committee meeting before delving in the details x)
 
Ven
definitely DOA for now
 
concept tribool
DOA?
 
Ven
1:52 PM
dead on arrival
 
just from the first few lines it seems like it's trying to replace std::foo<myType>::type with std::foo(myType)
how far off am I?
 
nwp
I keep writing writing bugs that are caused essentially by having a callback on a movable type. I should eventually learn from that.
 
Ven
knowledge was moved from your body
 
std::move(your-body)
 
nwp
The knowledge is still here, it's just that my body happens to have moved in the meantime.
 
Ven
1:59 PM
overloading type functions
X D
 
niiiiice :D
 
Ven
> Also note that it is more concise, even compared to Stroustrup's "natural syntax" (see [P0694]):
 
Vasaline confirmed
 
Ven
Il faut bien au moins au temps de Vasaline
 
> Nicolas Hulot est-il encore utile dans ce gouvernement ?
wow
 
Ven
2:05 PM
@Morwenn the proposal is absolutely insane, even, by C++ standards
and it's well known that C++ standards suck.
 
@Ven I guessed so, which is why I decided not to read it ^^"
 
Ven
It has many interesting things (no, really) and then it butchers it by
TRYING TO ADD YET AGAIN ANOTHER TURING-COMPLETE ASPECT TO C++.
Is this something people do it to add to their résumés? "Responsible for one of the 17 turing-complete subsystems in C++"
 
also C++ would probably have fewer problems if it didn't adopt most of problems C already had x)
 
Ven
@Morwenn yeah, if C++ didn't adopt C's problems it would have none, because no one would've used it.
 
remember some committee members want big features that "enable new paradigms"
@Ven even then it likely would still have problems XD
the funniest part is that it still had a positive impact on C
"C++ removed that part because it sucked balls, shouldn't we do the same? mmmh, maybe if we start deprecating it for 15 years beforehand"
 
Ven
2:09 PM
"... make it 30"
Well, now I'm sad. I read that proposal with high hopes.
 
now C evolution is mostly driven by stealing smallish features from C++, trying to tweak/fix floating point numbers and adding new ugly keywords to solve problems they can't solve with the library
 
Ven
.oO( If you think writing C in C++ is bad, wait til you see people writing C++ in C )
 
...
I think C should have more people improving its functionalities, since so many languages have been written in C, those functionalities can be transferred into those languages
 
Ven
@Morwenn
> We propose that type functions follow ADL, as shows the following example.
Si je voulais l'inventer je pourrais pas.
 
@Ven have seen, gcc introduced a scope exit extension they are trying to get standardized
 
Ven
2:12 PM
@Mgetz they want to stole our RAII
 
@Ven hahahahaha xD
 
@Ven then why not just use C++... honestly it's dumb
 
constructors, destructors, members functions and access specifiers have already been proposed for C
 
Ven
also tbh void f(Foo{} a, Foo{} b) / void g(Foo{T} a, T b) is fine by me
  std::type_index indexof(typename T) {
      return std::type_index(typeid(T));
  }
 
The CPLEX TS adds almost 20 new keywords to C >.>
 
Ven
2:14 PM
German CPLEX?
 
The C extensions for parallelism
 
Ven
ah, ok
 
@Morwenn I think the name is apt... I can call it complex
@Morwenn I believe LRIOs response was something along the lines of "Why not just take the entire 98 draft"
 
_Reduction _Type _Combiner _Initializer _Finalizer _Order _And _Or _Min _Max _Last _Commutative _Associative _Task_parallel _Block _Spawn _Sync _Call _Capture _Options and I might even have missed a few
@Mgetz because people won't use exceptions :o
 
2:18 PM
@Morwenn they don't have to now -_-
 
Exactly 20 new keywords
 
Ven
@Morwenn ok so that proposal has. 1) type functions 2) ADL for type functions 3) overloading for type functions 4) switch type casing 5) Algebraic data types 6) meta-classes like stuff 7) compile-time reflection 8) type&type functions composition 9) newtypes (in the Haskell sense) 10) type attributes 11) type constructors 12) operator overloading for types 13) foreach for type packs 14) concept overloading
 
How could anyone think it was a satisfying solution
@Ven it solves the world :o
 
Ven
I just went through it and I'm not sure I'm still alive or not
 
@Ven Ok they need to change the name to actually be COMPLEX
 
2:20 PM
@Mgetz CPLEX was the C parallel proposal, not what Ven is mentioning
 
@Morwenn apologies it looked like they were replying to you in thread
 
we've been mixing two conversations for a while now
@Ven what if it eventually gets accepted :3
 
I can't find any consistent results for performance bench marking of C vs C++ vs Java vs C# vs others
 
Motion to rename the language into C+++
 
Ven
@Morwenn dont' give a fuck i don't do C++ anymore anyway
 
2:22 PM
until the day you end up in a company's basement for some reason
 
There are always people claiming Java is the fastest, I express my suspicion on their claim.
 
nwp
@TelKitty Consistent with what?
 
performance ranking
for maths operations, string operations, memory management etc
 
nwp
Also applies to benchmarks.
 
@TelKitty like anything you can manipulate benchmarks to say whatever you want
 
nwp
2:28 PM
And if you count things like inline assembly.
 
@nwp which can actually be slower due to the compiler being unable to schedule around it
 
@nwp jfc, want to find a smaller image by any chance?
 
@LucDanton Mu
 
Ven
@nwp lol
 
2:35 PM
Juste d'la qualité.
 
Ven
TMTC bro.
 
@Ven it's good that they think about it. As long as the conclusion is: Hell no. Even template Haskell doesn't get it right, and they have decades of the advantage
 
Ven
@sehe I mean, template haskell being bad has been accepted for a while, FWIU.
It's really not that good
 
3:06 PM
@BartekBanachewicz ah man. There's a bike store that has a Triumph Bornville America 800 that I was really tempted by, but when I looked up it's stats, it's only 45kw, so wouldn't be enough to use when I do my A test. I might get it yet though, if I can't find anything better
Worse case I ride it for a few months until I find a bike that'd be ok for riding during test
I'd like to ride my own bike during test so that I am comfortable with it
 
Searching for answers on stackoverflow is a lot like buying lottery tickets - you might get nothing from reading a lot of answers, but you might get an answer that solves your problem.
 
4:08 PM
@thecoshman 45kW or HP
How much is required for the test?
 
kw, 50
hang on... now I'm doubting myself...
lol, bonneville not bornvile :P
yeah, 45.2kW :(
needs to be 50
 
 
3 hours later…
7:27 PM
Is there a term for an object giving out other objects (of a different type), but those other objects are only valid for the lifetime of the first object? Iterator invalidation would be a specific case of this.
 
7:46 PM
@Maxpm en.cppreference.com/w/cpp/memory/shared_ptr see the aliasing constructor
it's magic
specifically number 8
 
What on earth.
I'm surprised I haven't seen this before.
 
@Maxpm for what it's worth, Herb Sutter who's on the actual committee didn't know about it until after standardization
 
8:08 PM
@fredoverflow First attempt. (Only skimmed the book, mostly messed with code :)
I'm doing binary expression weird though.
 
Is that shared_ptr thing a common pattern for solving this issue? Any examples in the wild? I've been trying to see how other libraries do it, but it's kinda hard to Google.
 
8:34 PM
@Maxpm The closest I've seen in the wild is Microsoft's COM, so no sadly. You don't see std::shared_ptr much in libraries because it has overhead
 
@Maxpm That's how lifetime of nested objects works by default
When I was new at my job my colleagues called it "having parent-child relation". Took me a while before I realized they were talking about an ownership model.
 
nwp
Because children never outlive their parents. Great mental model :P
 
8:52 PM
@StackedCrooked Sorry, let me clarify. It's not a nested object in the composition sense. The children are created dynamically.
"Creator" might be a better word than "parent."
Again, like how an iterator can (incorrectly) outlive the container that it came from.
I'm wondering if I should just document that you can't use something after its creator dies, or if I should take measures to prevent that from even being possible...and if so, what those measures should be.
 
9:08 PM
Okay, but why is the creator allowed to die?
 
@Mikhail Why is the creator allowed to die at all, or why is the creator allowed to die before its children?
 
@Maxpm I think somebody mentioned what you need is a pointer in each child to whatever parent these objects share. The only way to shoot yourself in the foot is if the children own the parent. So, don't use any god damn smart pointers.
You can use a factory pattern to deal with them
 
nwp
@Maxpm You don't defend against that in C++. People can create pointers of your object, let the object go out of scope and dereference the pointer and there is nothing you can do about it.
 
we need a trigger warning for shared_pointer
 
nwp
In the rare situations when you can do something about it, because you happen to store subobjects in a shared_ptr anyway then you can advertise that as a special feature.
@Mikhail I want a trigger warning for people mentioning trigger warnings. It triggers me.
 
9:20 PM
Why don't you like shared_ptrs, @Mikhail? And why is it shooting myself in the foot if the children own the parent?
 
@Maxpm In short, legitimate uses of the object mean your code is fucked because you don't have control over where and when resources are destroyed.
 
Hm.
 
nwp
There are situations when they are appropriate, but they are a once per year kind of thing. And most of the time you didn't need them after all.
 
Like when your program or external libraries are fucked but there is no time to fix it
 
I think what's tripping me up is that the children don't represent "parts" of the parent, exactly. In my case, the parent is a hardware device and the children are DMA channels.
 
9:34 PM
yeah, so each child has a pointer to the hardware device
CHILDREN SHOULDN'T OWN THEIR PARENTS
 
It doesn't seem wrong to me that a dependency's lifetime should be dragged out as long as there are things depending on it.
 
But also possibly longer, for example you might find it unsavory to constantly remake hardware device handles
 
10:07 PM
@Maxpm If children owns their parents no intuition in the world is going to help you reason about your model.
The Skoda model T was built on a Basket made by Chrysler from a river in the Tigris valley?
 
Frankly, that seems like a non-problem. I'm programming in C++ over C for a reason. Why do I need to know and control the exact point the destructor is called?
 
@Maxpm Fine, if you explicitly state that you want things to blow up. Go ahead.
 
nwp
Because in C++ that knowledge and control comes automatically. You mostly bind the life time of stuff to other stuff which gives you precise control and knowledge with zero effort.
And yes, you can screw that up with shared_ptr, but that doesn't give you any advantage.
 
Perhaps the more important point, from writing dozens of these kind of hardware adapters, is that life cycle management needs to deal with possible hardware faults as well as prevent the rapid creation destruction of handles. See Bjarne's frustration with destroying sockets.
 
"Blow up." A couple dozen bytes hang around for a little longer. Ooooh, scary.
 
nwp
10:15 PM
"A little longer" is not gonna happen. It's either immediately gone or stays forever.
That last bit is actually scary for certain resources.
 
Okay, but if someone needs a reference to something, presumably they need that reference. It sounds like you're proposing I yank it out from under them anyway.
@Mikhail Got a link? Fortunately, I think it's acceptable in my case to just panic on any hardware problem.
 
nwp
They have to know that if there is a Resource_provider and they use .get_resource() on it and then let the Resource_provider go out of scope that their resource is invalid. If you are nice you can try to assert that somehow. If you are evil you do shared_ptr shenanigans that hide the bug.
 
@Maxpm I'll take famous last words for $200 please. I'm confident I get the double at $400.
2
 
Heh.
@nwp I understand your position, I just don't understand why you hold it.
It doesn't have to be "hiding a bug." It can be turning a bug into a non-bug.
 
nwp
It's a bug in the core language. That's how dangling pointers and references work. You are proposing that in a select few cases you might be able to make it not have bad consequences and for the rest the same rules as always apply.
Since you must deal with dangling references anyway there is no point in going out of your way to make dangling references impossible, because you cannot in C++. You just force the user to pay for features that they don't use anyway.
If you think that is dumb I can understand. Use rust where that problem doesn't happen.
I think there are funny names for that. "Principle of least surprise", "KISS" and something about failing early making better systems.
 
10:29 PM
But it's not a pointer, or a reference. It's a user defined type. Why should you expect an apparent value object to have the same lifetime concerns as a pointer or reference?
I haven't given you a reference to a part of me; I've given you something else, that happens to need to talk to me sometimes.
 
nwp
You should tell the user that that reference needs to talk to something else that better be alive when it does if there is a chance they can screw it up.
 
BRB.
 
How do you prevent multiple resource managers from being created?
 
11:01 PM
Multiple resource managers can and should be created.
 
11:27 PM
@Maxpm So you need a resource manager manager...
 
11:41 PM
@Maxpm I suspect you can pull it off because you're hiding the resource manager from the end user (or at least prevent its access without a connection object), although I'd personally had trouble implementing these kind of designs because the underlying handles would often need to be substituted, and the rapid creation of resource managers was really undesirable. Also take a look at the thread safety of a shared_pointer. Good luck.
 
nwp
I have recently realized that shared_ptr has the same thread safety as an int, so, (almost) none.
 
@nwp In practice it's worse than that though. shared_ptr makes it much easier to accidentally pass a shared pointer across thread boundaries, and end up with two threads manipulating the same object.
 
nwp
I don't see the increased danger compared to other pointers or ints used as an index.
 
11:58 PM
@nwp When you're using it directly there probably isn't any. The big problem arises when you're using it internally, to create something that looks like a value, but actually has COW semantics (or similar). Of course, you could also do that without a shared_ptr, but shared_ptr makes it seductively easy to do.
 

« first day (2782 days earlier)      last day (2170 days later) »