« first day (1235 days earlier)      last day (3728 days later) » 

user1804599
7:01 PM
I should try Org mode.
 
In all honesty, I think shared_ptr needs fixing up a lot more.
The ref-counting bits are useful on their own, and not reusable.
 
Is there such a thing as a pdf side-by-side diff? I want to compare two copies of the C++ Standard.
 
CRITICAL_SECTION cs;
InitializeCriticalSection(&cs);
// InitializeCriticalSection() can't fail and returns void, but we need the delete to occur prior to scope exit...
// Otherwise it remains on the process's linked-list of active CRITICAL_SECTION's.
auto &&pCS = std::make_scoped_resource_unchecked(&cs, DeleteCriticalSection);   // DeleteCriticalSection can't fail and return void
Ugh, it's almost like there's no good code example in that proposal :S
 
user3010322
... That examples is almost exactly like BOOST_SCOPED_EXIT
 
7:13 PM
Hi :)
Man, I haven't come here in a long time. :o
 
user3010322
I employ the same thing when working with D3D primitives.
 
user3010322
Having a std:: backed primitive to do the same thing would be helpful.
 
Btw can your scoped resource handle pointers without typing stars or deleters? No? unique_ptr is a generalisation of your scoped_resource.
Ugh
That's horrible.
That code has no business outside of a destructor
 
user3010322
... It's a map call.
 
Unmap is not a map call
 
7:16 PM
@Tuntuni Given the interminable scoped/pointers thread going on, it'll probably be a long time before you're back again:)
 
Why do the people clamouring for scope guards always give examples of code to put in a destructor?
 
@MartinJames Haha. I can handle it, I hope. :D
 
user3010322
Because a new class in a destructor means I have to import all the scope and variables of the SetData and Texture2D class?
 
@Tuntuni Oh - 'handle' is also to be avoided.
 
user3010322
Why the fuck would I do that?
 
user3010322
7:17 PM
That's completely ridiculous.
 
@MartinJames Ooops. :o
 
user3010322
... Wait a minute, you're confusing me for no good goddamn reason.
 
user3010322
That code is in a destructor.
 
user3010322
You just can't see it.
 
7:18 PM
@Tuntuni Stick to beer/food/sex. It's safer, even without a condom.
 
Xeo
@R.MartinhoFernandes honestly, I think it would be more useful for fail-safe mechanisms, like transactions
 
The lambda passed to make_destructor isn't.
 
user3010322
I gets put in a destructor and called.
 
It should be in a destructor of its own.
That's the point.
 
user3010322
... How do you propose I make that destructor, for each specific instance of the SetData call?
 
7:19 PM
Er
 
user3010322
Write a new class and then pass to it all the state data?
 
Come on, this is trivial.
 
user3010322
You keep talking about how it needs to be in a separate destructor. But it is. make_destructor makes a crap class and puts the necessary code in a destructor.
 
user3010322
What's the problem?
 
It's not its own destructor.
 
user3010322
7:21 PM
What does that even mean?
 
In the same way that calls to mutex.unlock are not put in lambdas passed to scope guard functions but are instead in the destructor of lock_guard.
 
Xeo
@ThePhD that it stands alone. why is it not coupled to the Map call?
 
Come on, this is RAII 101.
 
user3010322
lock_guard takes a mutex and holds a reference to it to perform the lock and unlock. lock_guard does not have any state or out-params to deal with when calling the appropriate function, or any return values.
 
7:24 PM
hi
 
1 hour ago, by Cat Plus Plus
Also it'd be much better idea to add finally to the language to handle that case
:v
 
user3010322
You want me to write a specific class who's job it is to call Map on construction, and Unmap on destruction, and then write a specific class to also do Prepare on construction, and Unprepare on destruction. And then you want me to do Create, and then Release, etc. etc. You want me to also write a specific class for every single one. Then I need to deal with its specific out parameters by passing all that state into the constructor, and I also need error handling for the return codes
 
user1804599
C++ should have built-in support for scope guards.
 
user1804599
They are incredibly useful in some cases where you want strong exception guarantee.
 
user3010322
I've yet to see a generalized scope_guard in the form of lock_guard that can handle any of the cases I just described above.
 
user1804599
7:28 PM
Writing a class for all these things is cumbersome and error-prone.
 
user3010322
I'm sure I could write one, though?
 
we are writing an exam about lambda calculus next monday
 
user3010322
I'll make it
 
user1804599
That sounds fun.
 
it's about such things like curch numerals and proving soundness
 
@JohannesSchaub-litb Lambda calculus doesn't even have integers, right?
 
> the mistakes involve errors with several "goto cleanup" calls.
RAII fuckers.
 
Xeo
C, fucker
 
Low-level savages
 
user3010322
scope_guard<MapCall<ValidationPolicy>, UnMap> guard( make_MapCall( tex2, dest, Dx::ToPlatform<D3D11_MAP>( mapping ), 0, &res ), UnMap{} );
 
user3010322
7:31 PM
..... WHAT
 
user3010322
WHY WOULD I EVER GO THROUGH THIS NIGHTMARE
 
user3010322
WHY WOULD I EVER WRITE THAT KIND OF SHITTY BOILERPLATE
 
Writing FFI wrappers is tedious, unrewarding and 90% boilerplate
 
@FredOverflow yeah but often we are using some "integers" like "[n]" syntax in our grammar, with that syntax embedding the natural numbers
 
@DeadMG if only we could post images in the comments
 
7:32 PM
That's the reality of FFI
 
but right in the bare metal lambda calculus you don't have integers, so you have to create some function definitions whose nesting levels represent the numbers
 
@ThePhD I don't understand what a good part of that is for. MapCall and UnMap and make_MapCall all seem to me to be totally unnecessary.
 
crazy shit lol
 
The point of FFI wrappers is to hide all that boilerplate in a reusable package
But someone has to write it or generate it or whatever
 
user3010322
@DeadMG I was told I needed a specific destructor for my D3D's map code, and I was also told it was bad because it was not paired with a constructor. So I wrote a reasonable approximation of what a generalized scope_guard class would look like.
 
user3010322
7:34 PM
And that reasonable approximation is flagrantly dumb.
 
looks to me like you totally overengineered what the generalized version would look like.
 
user3010322
Feel free to take a crack a C-based scope_guard out-param-catching would look like.
 
I wouldn't even bother with generalised anything
 
user1804599
Generalise everything.
 
user3010322
... So I should just... y'know
 
user3010322
7:35 PM
write a function
 
also there's that.
 
user3010322
dxresultcode r = context.Map( tex2, dest, Dx::ToPlatform<D3D11_MAP>( mapping ), 0, &res );
if ( FAILED( r ) )
	throw Exception( "Unable to Map Texture2D to device" );
auto dx = make_destructor( [ &context, &tex2 ] { context.Unmap( tex2, 0 ); } );
 
user3010322
A function ^
 
the real question is what you gain by generalizing, since every case is different
there's little useful logic in common.
wait.
 
user1804599
Sass is so much better than LESS is.
 
7:36 PM
did you really just suggest that that is better than the "boilerplate" you wrote above?
 
Xeo
yes
 
user3010322
It's plenty better.
 
Xeo
that's what he has
and we said it's bad
 
it's clearly about three-four times the size.
with multiple redundant local variables.
 
user1804599
That’s what you said.
 
7:37 PM
and no safety.
 
user3010322
It's entirely exception safe.
 
user3010322
If the map call fails, the resource isn't mapped. It's free to call an exception.
 
user3010322
If it doesn't fail, the destructor gets made.
 
@rightfold I have to be honest with you: when you suggested LESS I really went with SASS
:)
 
user1804599
@Jefffrey Sass is way better.
 
user1804599
7:38 PM
At least it has functions and for loops.
 
user1804599
No need to use recursion and fill the namespace with redundant mixins.
 
@ThePhD Only if every time I copy and paste that bit of code I always include the "Destruct this" line.
 
user1804599
Also woohoo significant whitespace.
 
user1804599
I wrote a grid system in 9 lines of Sass. :P
 
Hello
 
user1804599
7:39 PM
Hi sweety.
 
@rightfold can I see? :3
 
user3010322
@DeadMG What you forgot to account for was the class MapCall and the call UnMapCall, the scope_guard class that's not in the standard that you have to write (once, so it's neglible), and the ValidationPolicy class you have to write for that ONE SPECIFIC INSTANCE of exception handling (which you may handle completley differently in another segment).
 
also it's been created by the same people of HAML IIRC
HAML is very good too
 
user1804599
Mixins, not classes, because adding such classes to HTML is a terrible idea.
 
Xeo
7:40 PM
@ThePhD you're overthinking this
 
user1804599
I don’t understand why people like crap like class='col-lg-4' but not <font>. It’s practically the same problem.
 
@rightfold yeah
well, <font> is kinda getting deprecated, no?
 
user1804599
It is deprecated, yes.
 
user1804599
I wrote unit tests for that Sass code, by the way. filevoid.net/2536470434/… :P
 
yeah, they were both very bad ideas
 
7:42 PM
@ThePhD The one MapCall class can handle UnMapCall and the ValidationPolicy. There's no point translating the same failure to different exceptions in other places.
also make_MapCall is redundant, you can just do a std::thread thing in the scope_guard constructor.
 
@rightfold lol
do you measure it with a ruler? :P
 
user1804599
No, with JavaScript.
 
user1804599
The first test is assert('full-width-test', row.offsetWidth === column.offsetWidth);.
 
user3010322
@Xeo You tell me my code is bad and that I need to write a class that does mapping and unmapping. Even if you fold MapCall and UnMapCall together and completley throw out the idea of scope_guard, there;s still the issue of error handling (default it to not-zero error handling or some default validation policy?, fantastic).
 
nice
 
7:43 PM
@rightfold At least if I'm following what you're saying, I see a pretty basic difference. HTML should be concerned with the logical structure of a document. CSS should be concerned with how you present that logical structure to the user. Markup like <font> mixes the presentation aspect in with the logical structure, which is inherently a poor idea.
 
user1804599
The last one is a bit nasty because the browser rounds these things off to pixels.
 
user1804599
var firstWidth = (firstColumn.offsetWidth * 2);
var secondWidth = (secondColumn.offsetWidth - 40);
assert('double-width-test', Math.abs(firstWidth - secondWidth) <= 2);
 
@ThePhD You should always handle a failure to create a resource in the same way.
 
user1804599
Hmm, I should rename that variable.
 
and you should always be able to do this by throwing an exception.
 
7:44 PM
Does the standard say anything about static and shared libraries or are those defined by the implementation?
 
@JerryCoffin classes are also used for presentation and they are often inside the HTML :(
 
what does mean "the same way"?
you mean, always throw the same exception type?
 
user3010322
Notably, in many other segments in the engine I catch different kinds of error codes and modify the function call's parameters accordingly to attempt to get the right call going without compromising. It's the same Map and Unmap function, but the parameters are wildly different and change from Texture2D to VertexBuffer. So the class would either need to be templated on those things or I'd be writing a new class for every time I needed to call the Map and Unmap functions.
 
@Tuntuni Implementation.
 
user3010322
At this point, I've vastly exceeded the amount of code I'm calling versus just calling the function and having a scoped destructor and doing my custom error handling in-line.
 
7:45 PM
i.e don'T do "throw NoMainMemoryAvailable" at once place and "throw NoDiskSpaceAvailable" at another space?
 
@JerryCoffin Aha, thought so. One other thing - what about "C name mangling"? I'm currently reading some articles on calling conventions, DLLs, etc. and "extern "C"" keeps popping up. Is C name mangling defined somehow or is it also implementation-specific?
 
@Jefffrey Yup--HTML is a fairly poor design overall. <font> just happens to be one of the worse parts.
 
You can't do concurrency with threads. I think you're confusing concurrency with parallelism.
 
@Jaigus Haha
 
@Tuntuni Also implementation.
 
7:47 PM
@ThePhD Putting the custom error handling in a class or lambda doesn't seem more problematic than inline, I feel.
 
user1804599
@Jaigus Hello.
 
user1804599
Have we met before?
 
I mean, you might disagree, but to me, when you say "Copy and paste my code a little bit wrong and MEMORY LEAKS/EXCEPTION UNSAFETY and also copy and paste is the only way to go" then I'm thinking that this is a very bad thing.
 
@EtiennedeMartel :P @rightfold why hello there
 
a lot worse than the inconvenience of making an error-handling lambda.
 
user1804599
7:48 PM
@JerryCoffin Yeah, as does col-lg-4.
 
@JerryCoffin Ah. Thanks. :)
 
@JerryCoffin It improved a lot with HTML5, though. They removed most of the "presentation" tags like <font> and added numerous other semantic tags like <section>, <main>, <article>, etc...
 
@rightfold I don't think so
 
user1804599
@Jefffrey Doesn’t matter; you can use <span> and <div> in HTML4 and not <font> if you want.
 
@Jefffrey It improved with HTML 5, but they were starting from such a deep hole that it's still pretty crappy.
 
user3010322
7:50 PM
@DeadMG But it's not copy/paste. It's "I have this situation, I wrote the code for it, I test it, and then I move on." The whole point is that this isn't a copy-paste scenario. This is a "each situation does its own thing, why in the world would I put it in a class if I'm only going to use it once and then have to write the whole thing unless I make a template-based clusterfuck" kind of thing.
 
@Jefffrey Does anyone even use them?
I haven't seen it in use.
Yet it's brought up as a selling point for HTML5 so it's weird
 
@Rapptz I do :>
 
user3010322
make_destructor is the only commonality between the calls: hence it was refactored into a quick function with a lambda. The rest is different enough and has different enough error handling to be part of the function's routine.
 
make_destructor being the critical point here.
 
@Rapptz It's a fairly dumb point
 
7:51 PM
:<
 
a single massive point of failure that if it fails, blows up your application spectacularly.
 
but... it's semantic!
 
@Jefffrey <font> was removed in HTML4
 
user1804599
@Rapptz We do.
 
user3010322
.. But it can't fail! That's the whole point!
 
7:51 PM
sure it can
you could just forget to call it.
 
user1804599
I wish Markdown converters did.
 
Also <section> etc is a replacement for <div>, not presentation tags
 
@CatPlusPlus hmm, I didn't say so... did I?
 
user1804599
My Little Editor: Emacs is Magic.
 
user1804599
7:53 PM
I love Emacs.
 
user1804599
@FredOverflow omgasm
 
@FredOverflow huh?
 
@rightfold Not the same thing in the slightest
 
it's finalised?
 
not to mention that you could just be a lazy arse and not add any error handling.
 
7:53 PM
@CatPlusPlus If memory serves, it was one (of many) of those things they said was not allowed, but then specified exactly how it had to be interpreted anyway.
 
@JerryCoffin Backwards compatibility is a thing
 
user3010322
Except... I'm not a lazy arse and I wouldn't forget to throw? That's the whole point I'm making my own engine and API? So there are no silent failures?
 
user1804599
It is not HTML’s business to tell what is and what is not a “column” whatever a “column” may be.
 
@ThePhD And here, the unsafety is clearly revealed for all to see.
 
If you use the new HTML5 tags you have a more semantically correct structure than a document full of <div>s and <p>s...
 
7:55 PM
"My code is safe because I, the programmer, am a wholesome righteous person who would not make mistakes."
 
There is no replacement for <p> :v
Also gives a shit jesus
 
everybody is a lazy arse, especially programmers, and everyone makes mistakes.
you absolutely would forget to throw.
 
@Jefffrey Yet everyone still uses <div>s :v
the semantic tags feel useless.
 
@Rapptz yeah, because :effort: I guess
 
user3010322
Wrapping it up in a class doesn't stop it from being unsafe, especially when I have to take the stuff in that function and put it in a class that I only use once.
 
7:56 PM
<nav> is the most useful of the bunch
Navigation being a thing that screen readers shouldn't blindly read
 
@ThePhD It's more safe because if you want to be a lazy arse and don't, or simply forget, then it won't compile.
 
So is C++14 actually finalised?
 
The rest is not very useful
 
and it's more safe because you cannot forget to call make_destructor.
so you are protected from these mistakes, they either cannot occur or your program will fail to compile.
 
@CatPlusPlus yeah Jesus! give a shit FFS!
 
7:57 PM
who just went full retard with the stars?
 
Stop starring every fucking thing
2
 
mass starring
 
I've only starred 1 message from cat
 
stop it, please!
 
the one about jesus
 
7:57 PM
alright why the fuck is random shit star'd
 
woops I think I cancelled an 8-star message.
 
all is well
 
that message deserved a star
 
@DeadMG :lol:
Good job
 
@DeadMG lol
which one?
 
user3010322
7:58 PM
I hope it was the one about me being a moron. c:
 
I don't think any had 8
 
@ThePhD that's one of the great lounge<c++> axioms
 
There's a replacement now
 
I don't remember
 

« first day (1235 days earlier)      last day (3728 days later) »