« first day (1623 days earlier)      last day (3308 days later) » 

user1804599
7:00 PM
I have an atomic problem.
 
user1804599
Consider this: gist.github.com/rightfold/81cd2d3dd1a394eafa7c. I guess that's a problem because other thread may see fastAvailable is true, but fast as still not set, right?
 
@LightnessRacesinOrbit lol
 
woah who is this 340k user who just randomly popped up in ? stackoverflow.com/a/29308319/560648
 
user1804599
It's an F# guy who has experience with C++, though I don't know how much.
 
user1804599
He's often in the C# and F# rooms.
 
7:04 PM
never seen him before
which seems strange
thought I'd have run into him in C++ land
oh well
 
@LightnessRacesinOrbit check his tag-details, he's obviously been hiding in and
I'm bloody bored.. anyone that has a related issue that could use a second opinion?
 
user1804599
@FilipRoséen-refp see a few messages above where I linked to a gist
 
@райтфолд care to copy the permalink to that message for easier access? I'm lazy
20 mins ago, by райтфолд
lol https://gist.github.com/rightfold/d56c09e243e09ec91e73
 
user1804599
7 mins ago, by райтфолд
Consider this: https://gist.github.com/rightfold/81cd2d3dd1a394eafa7c. I guess that's a problem because other thread may see fastAvailable is true, but fast as still not set, right?
 
.. you were to slow
 
user1804599
7:10 PM
:P
 
user1804599
Problem is at line 9. I think the new value of fast may not be visible to the thread.
 
user1804599
Unless std::atomic<bool> does synchronisation for that?
 
This is how emacs handles copy/paste: emacs.stackexchange.com/q/10344
 
no
the atomic<bool> synchronizes the atomic<bool> and that's it.
if ou want to synch something else, you'll have to handle it.
 
@LightnessRacesinOrbit What's special?
 
user1804599
7:13 PM
Alright.
 
@райтфолд std::atomic<bool>'s operator bool () is equivalent to x.load (std::memory_order_seq_cst), which means that we can't judge whether the snippet is well-formed without looking at where the entities are use (since the data-members are public, if you write to them without correctly adjusting the synchronization you will have undefined-behavior)
 
@FilipRoséen-refp chat.stackoverflow.com/transcript/message/22342302#22342302 Start here and read far far down
@R.MartinhoFernandes ok sorry
 
user1804599
@FilipRoséen-refp vm.cpp is the only place they are written to.
 
@LightnessRacesinOrbit I'm genuinely curious and feeling I'm missing something.
 
user1804599
I should make them private and friend VM.
 
7:14 PM
@райтфолд oh snap, I didn't see that it was a second snippet
@райтфолд yes, the usage in the second snippet is safe. the synchronization of std::atomic will make sure that the previous stores (line 1) will be seen by any thread that sees that fastAvailable has a value of true
 
@райтфолд Hmm, I'm actually not sure if that's true, looking at the second snippet.
I think that should be fine.
 
user1804599
@FilipRoséen-refp Nice.
 
as long as no thread reads or writes fast without checking first that fastAvailable is true.
 
If I have a copyable class like X here, is it stupid to violate the Rule of Zero and provide (defaulted) special member functions to make the client not dependent on the definition of Y? (the member functions would be defined as defaulted in a separate translation unit)
 
user1804599
Yeah gonna make the members private ASAP.
 
user1804599
7:16 PM
These snippets are the only places they are (and should be) accessed.
 
@LightnessRacesinOrbit you serious, or trollin'?
 
user1804599
Thanks.
 
@FilipRoséen-refp Sigh. Ok sorry.
 
@AndyProwl Can you even do that?
 
can't bloody win in here
 
7:17 PM
I don't believe you can.
 
@R.MartinhoFernandes Sure I can, why not?
 
default affects the observable semantics of the class.
 
@LightnessRacesinOrbit I'm referring to the "read far far down"; is it worth it?
 
@FilipRoséen-refp You asked for a C++ question to look into. I posted one to you. What is the problem?
 
@AndyProwl What can you do in X's definition that won't require a complete Y?
 
7:18 PM
@LightnessRacesinOrbit that I wasn't sure whether it was interesting enough to spend time reading, or if you just linked something that would end as ".. and that's how I become the prince of bellair"
 
@R.MartinhoFernandes In X's definition I would only declare the member functions. I would default them when defining them in a separate translation unit
 
never trust the Internet, etc.
 
I think I'm just going to go.
 
you can't define them as defaulted out-of-line, I believe.
 
@AndyProwl Ok, let's try something else, then :P What can you do with X that won't require a complete Y?
 
7:20 PM
@AndyProwl If you want to hide dependencies then the answer is probably pimpl
 
jftr.. A::A() = default; having struct A { A (); }; is well-formed.
 
The whole thing just seems wrong to me.
 
@R.MartinhoFernandes For instance I could call other member functions of X that do not involve Y
@CatPlusPlus That would force me to provide those special member functions anyway, no?
If the class has to be copyable...
 
Probably yes
 
So I'd be back to violating RoZ
 
user1804599
7:23 PM
Oh, fuck, I define multiple LLVM functions with the same name.
 
I should stop wearing white t-shirts when I'm eating
 
Basically, the existence of Y is an implementation detail
 
user1804599
Maybe that causes the infinite recursion.
 
Especially chocolate
Ugh
 
user1804599
Boost.Uuid!
 
7:24 PM
@CatPlusPlus No shocklit plz!
 
Also how do I set audio volume in UE4 editor
 
user1804599
HURRAY IT WORKS
 
I should go for dinner.
 
me too
but I'm not going to
I'm going to finish up here, get showered, get dressed, get drunk.
 
i wanna write a lalr(1) parser. why the fuck is it so hard to understand how to write one?
 
7:32 PM
You don't typically write table-driven parsers, you generate them
 
thanks, that might help
 
@LightnessRacesinOrbit "get drunk" Why do you need to shower before?? Or even get dressed?
 
And if you want to write a parser generator then well, get crackin on the theory
 
user1804599
Write parser combinators, not parser generators.
 
user1804599
They're easier to implement and easier to use.
 
7:35 PM
> In functional programming, a parser combinator is a higher-order function that accepts...
> functional programming
:C
 
@LightnessRacesinOrbit Leaving for the pub might be a valid reason ;-) ...
 
@райтфолд And orders of magnitude slower...
 
@Blob They were never meant to be written.
 
I write recursive-descent parsers by hand, because I'm fucking hardcore and I don't like generated code.
 
instead of all this crap, i want to do something like store tokens in a stack and reduce when i see fit, but can't come up with a good way to properly reduce what's necessary
i might (imitate (LISP or something))
 
@FredOverflow You just don't have the right generators at hand, admit it ...
 
@FredOverflow recursive descent is pretty easy to do by hand though
 
What's your goal, to parse something, or to write a parser
 
they're so easy that Wide uses a hand-written table-driven parser
 
@CatPlusPlus parse something, and hopefully achieve that by writing a parser or parser generator or whatever
 
7:40 PM
@πάνταῥεῖ Well I could walk to the bus stop and get on the bus then walk 20 minutes and then spend 5 hours then potentially go to a bar in town for 4 hours then go to mcdonalds then get a taxi home at 3am..... somewhat sweaty, with bed-hair and in my pyjamas, but somehow I think it might cause my night to be less enjoyable than it would otherwise be.
 
If you want to actually parse something then don't bother with building parsers, use an existing thing
 
it's more of a journey than a goal
 
hah, "3am" was spot on. accidentally.
 
It's a crappy journey
 
then "parse something" is not the goal.
 
7:40 PM
@LightnessRacesinOrbit maybe if we went together
 
@LightnessRacesinOrbit Sure, you shouldn't appear undressed and bad-haired in public :-) ...
 
What kind of parser would you need for bpf parsing?
 
@StackedCrooked A bpf parser.
Cheers & hth.
 
Any kind of parser
 
@LightnessRacesinOrbit answer of recursive descent.
 
7:43 PM
@StackedCrooked My life is in recursive descent.
 
The recursive descent into alcoholism.
 
Among other things, yes.
 
It's a great life.
 
@Puppy It's what all major compilers like clang and gcc use, right?
 
@StackedCrooked Pffft!
 
7:44 PM
lol why does github think that 4.2% of my code is written in Python? I have never written a single line of Python in my life
 
@πάνταῥεῖ Any recommendations? I don't like ANTLR, because it has a runtime dependency.
@AndyProwl Did you indent your code without using braces, maybe? ;)
 
@StackedCrooked I abstain. And if you have to ask, your code is too complicated.
@AndyProwl Whython.
@FredOverflow lol
 
@FredOverflow I don't think so, but could be
 
 
oh wait
 
7:45 PM
It started simple. Then I added things because it seemed too simple. I suck.
 
fuck me, I forgot GMock is part of the repo
there must be some python in there
 
@AndyProwl You have committed e.g. GTest
@AndyProwl I can see numerous .py files in your repos.
 
47 secs ago, by Andy Prowl
fuck me, I forgot GMock is part of the repo
 
user1804599
@FredOverflow [citation needed]
 
user1804599
My parser is fast enough.
 
7:46 PM
@AndyProwl ok sorry
 
@FredOverflow They pretty much have to because you basically can't really parse C++ with a generator.
 
@LightnessRacesinOrbit lol no problem, thanks for looking into it
 
@StackedCrooked too late on a Friday unless you pay me
;)
 
Tagless unions, mutable, and implicit conversion to bool. github.com/rmartinho/yajna/blob/master/include/hlife/… @ThePhD would be proud.
 
7:47 PM
I pay you one coliru.
 
@R.MartinhoFernandes It's easy.
 
user1804599
This is how I implemented comments in my lexer. :)
 
user1804599
my $space = qr/[ \n]|#\(.*?\)|#.*?\n/s;
$code =~ s/^$space+|$space+$//gs;
 
@R.MartinhoFernandes did you put it in the public domain out of shame?
@StackedCrooked augh touché
 
Now I'm finally going for dinner, if there's any left.
 
7:48 PM
lol, I didn't mean it like that
 
user1804599
Regular expressions are awesome.
 
@LightnessRacesinOrbit I CC0 everything I put on GitHub.
 
just wanted to say something meaningless
 
@R.MartinhoFernandes Wait you're done already?
 
@AndyProwl No.
 
user1804599
7:49 PM
Luckily Perl regular expressions are the good kind of regular expressions (i.e. not regular expressions) and I can make them work with nested comments. :)
 
Oh, ok
 
user1804599
This is nice, you can just put a hash/remove a hash to turn on/off the code by making the first line a single-line comment:
 
user1804599
#(
…
#)
 
user1804599
/* // similar in C++; add a slash to the beginning of this line
…
//*/
 
Right. It's Friday.
 
user1804599
7:51 PM
Although C++ has #if 0 and #if 1.
 
@райтфолд make sure it supports nesting
 
user1804599
@orlp Yeah, it's in my bug tracker.
 
user1804599
 
regex ugh
 
@райтфолд I use ugly imperative code.
 
7:52 PM
@FredOverflow it's not ugly
I think that lexing a language is best done using a hand-coded finite state machine
 
user1804599
@FredOverflow I use backtracking and alternative-trying instead of lookaheads.
 
user1804599
It's easier to maintain IMO.
 
What does mutable cell const* x; declare?
:S
 
user1804599
(eval is like catch and $@ is the exception)
 
user1804599
@R.MartinhoFernandes a mutable pointer to a const cell.
 
@R.MartinhoFernandes it declares the C++ declaration parsing order insane
 
I always forget that mutable is a keyword in C++. Maybe it can be put to good use someday.
 
user1804599
7:54 PM
mutable applies to members and lambdas, not to types.
 
mutable is for the variable and not the type, at least semantically.
 
@R.MartinhoFernandes A mutable const cell pointer.
 
user1804599
Guess why I chose # as the comment character.
 
user1804599
So I don't have to special-case #!. :)
 
#!?
 
7:56 PM
@FredOverflow mutable teenage ninja turtles
 
@Puppy shebang
 
user1804599
@Puppy the Unix thing.
 
oh
I thought # was the shebang.
 
@Puppy #!/usr/bin/poop
 
Sharp-bang
 
7:57 PM
@Puppy It's magic bytes 0x2321
 
user1804599
You can add #!runmill as the first line of baz.mill and executing the file will invoke runmill baz.mill.
 
user1804599
Funfact: the shebang isn't part of any standard and implementations vary wildly WRT argument passing and executable lookup.
 
If linux encounters an executable file that starts with 0x2321 it will read the first line to see what it should execute with
 
#!/bin/bash is the ultimate shebang. It refuses to work on weird systems which don't have /bin/bash.
 
user1804599
@StackedCrooked Windows!
 
7:58 PM
lol
 
user1804599
I personally like #!/usr/bin/env awk -f which works on OS X but not on Linux.
 
user1804599
#!/usr/bin/awk -f works on both.
 
#!/usr/bin/env rm -rf --no-preserve-root /
 
alright, here's a question
 
@orlp only 1 arg :|
 
user1804599
7:59 PM
@orlp It passes rm -rf --no-preserve-root / as a single argument to /usr/bin/env in some implementations.
 
if you have a larger pan, that would increase surface area of the contents, and therefore increase evaporation rate, right?
 
user1804599
It works as expected in others.
 

« first day (1623 days earlier)      last day (3308 days later) »