« first day (2229 days earlier)      last day (2734 days later) » 

12:01 PM
Why doesn't List.find return option
Why does it throw an exception.
 
I know
but I don't wanna tell ya
get rekt skrub
 
;~;
 
there's the namedtuple thing
which I suppose could work for me
 
nwp
@ThePhD So you don't write horrible O(n²) code? Or at least have to make it ugly to do it.
 
... ?
 
12:02 PM
^
that doesn't make much sense
 
Ven
sometimes that guy says thing you're supposed to ignore
because they don't make sense
 
match a with
| Some(x) -> match x with
     | [] ->
     | head :: tail ->
| None -> stuff
Could really go for some braces right now: OCaml has no idea where this stops
 
I see braces.
 
Ven
use begin/end.
 
Wirth™ the trouble
 
12:17 PM
@ThePhD stops at the end of expression?
also 0/10 needs monads
pattern matching on Some/None is for newbz
3
 
@BartekBanachewicz No I mean, despite the spacing it kind of glues the None match in with the List matching
 
Ven
match a with
| Some([]) ->
| Some(head :: tail) ->
| None ->
Functional™.
@ThePhD yeah that's because Ocaml's syntax is bad, use begin/end (like I said) or the version I just posted.
 
lolcaml 2.0
 
Ven
actually it's not ambiguous for the parser, it's just bad.
 
ocalm your tits
 
Ven
12:20 PM
Another thing that sucks in Ocaml is comparison. @BartekBanachewicz comparing two functions fails at runtime in ocaml.
 
gosh
but it's Object Orientatatated
 
@Ven lol
 
if it's objects it must good right
 
Ven
@BartekBanachewicz I could continue for years and years.
Did you know ocaml's strings are mutable? :)
 
how about no
 
12:22 PM
object oriented assembly 4 the win , trolololo
 
uncontrolled mutability is terrible
 
uncontrollable mutilation
 
almost uncontrolled anything is terrible
 
Ven
There was a page which compared Ocaml to the historic ML.
 
object penipulation
 
12:23 PM
I'm not saying that monads are the best solution for formally expressing code that depends on mutable segments, but they are at least an attempt
if a language doesn't even attempt to tackle that problem, that's either laziness or incompetence
 
Ven
there are a lot of things in this one.
 
> more "practical" language
my ass
 
Ven
The case that's interesting to @ThePhD is this one:
# Semicolon binds more tightly than match bodies and anonymous functions
match x with
    0 -> print_endline "It's zero!";
         true
  | _ -> print_endline "It's not!";
         false;;
 
@LucDanton the letter apostrophe is for IPA to mark ejectives.
Apostrophes are awkward, because they're not truly punctuation, but also not letters.
 
Anastrophes should be a thing.
 
12:29 PM
the more I think about it
 
The apostrophe in "can't", for example, is part of the word itself; not punctuation.
 
Ven
@sehe Instead it's a catastrophe
 
the more I realize that you can't really go half-ass on FP support
if you drop built-in exceptions in favour of composite return values, you need the whole support for them
 
In some writing or transcription systems, apostrophes actually stand for letters.
 
if you half-ass it, some noob will come in and say how annoying it is to actually write meaningful code with those
 
12:30 PM
The apostrophe in "Ba'al" stands for a glottal stop, so it's arguably a letter.
This happens in many words of semitic origin.
(Though there's a tendency to just drop them)
 
12:53 PM
@Ven I rewrote a large part of the Options parser using fold_left and stuff.
I don't think i got huge wins but the code looks better, I guess?
 
Ven
@ThePhD is it easier to read
 
Not... really?
 
Ven
I can't tell without something to compare
 
There's no more magic booleans at least.
 
Ven
;_;
 
12:56 PM
...
What's those tears for?
Come on now I did a good job. :<
Sigh
Well. Maybe one day I'll do it right.
Either way it's time to NAAAP.
 
Ven
I'm not sure I understand that acc shenanigan.
 
@Ven He's counting leading dashes in the foldi in the line that follows it.
I'm like 99% sure this can be written in a more comprehensible way.
 
Ven
..so am I
by extracting this function...
 
(The name of block doesn't seem to make any kind of sense though.)
 
Ven
Yeah, that's what I'm most confused about.
 
1:08 PM
Hello I have a question about some makefile.
 
I am trying the following command:
arm-none-eabi-gcc -march=armv7-a -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -c Demo/Drivers/rpi_gpio.c Demo/Drivers/rpi_irq.c -o build/Demo/Drivers/rpi_gpio.o build/Demo/Drivers/rpi_irq.o
 
Ven

C++ Questions and Answers

Solve problems and approach solutions. Just ask and lurkers wi...
 
@Ven there is nobody...
 
Jan 30 '15 at 2:30, by Borgleader
"Hi I have a question about my retirement fund"
"Sir this is a convenience store..."
"I know but it's the only thing open at this hour"
@Ven Also dashed isn't a very good name. :P
 
in C++ Questions and Answers, Aug 30 at 7:36, by milleniumbug
You don't ask a question because room is empty? Well, it's empty because you haven't asked the question!
 
Ven
@trilolil you didn't even ask a question
 
@R.MartinhoFernandes makes (actual) sense
@sehe lol
 
let is_dash idx = Polyfill.int_of_bool (arg.[idx] = '-') in
let dashcount = (is_dash 0) + (is_dash 1) in ...
Wait no.
Gimme a second, this catches too much.
 
> The narrative that Republicans are antiscience has been fed by well-publicized studies reporting that conservatives are more close-minded and dogmatic than liberals are. But these conclusions have been based on questions asking people how strongly they cling to traditional morality and religion—dogmas that matter a lot more to conservatives than to liberals.
> A few other studies—not well-publicized—have shown that liberals can be just as close-minded when their own beliefs, such as their feelings about the environment or Barack Obama, are challenged.
 
1:18 PM
@Griwes it's da shed man
 
let is_dash idx = Polyfill.int_of_bool (arg.[idx] = '-') in
let dashcount = if is_dash 0 then 1 + (is_dash 1) else 0 in ...
@Ven please sanity check
 
Ven
let starts_with str pre = pre = (String.sub str 0 (String.length pre)) in
match str with
| _ when starts_with str "--" -> DoubleDash (String.sub str 2)
| _ when starts_with str "-" -> SingleDash (String.sub str 1)
| _ -> Argument str
Not a fan of arg.[idx] because it doesn't boundcheck
 
Oh yeah, that's nicer.
Get's rid of the whole if arglen < 2 then raise(Error.BadOption(arg)); nonsense too, as a bonus.
 
Ven
yeah
 
@R.MartinhoFernandes a scan1 at that ;_;
 
1:21 PM
inb4 @ThePhD tells you it is wasteful because it calls starts_with twice (disregarding the fact that he always folds over the entire string)
 
Ven
I'm cheating with pattern guards. if | like the GHC extension would be nicer I guess
 
Ah look, @ThePhD also fails it on three or more dashes.
(Which is, arguably, silly.)
 
Ven
myeah
"---foo" in mine just creates a DoubleDash with "-foo" as a value.
No special casing of whatever.
 
Just add a | _ when starts_with str "---" -> raise(Error.BadOption(arg)) before the first of your matches.
 
Ven
yeah you can. I just don't want to specialcase it.
you'll need to check the values to fill your Settings struct anyway. You'll filter it out then.
 
1:24 PM
@Ven I'm just responding to the future comment from @ThePhD :P
 
Ven
anyway yeah that's how I'd do it. rather than your handmade whatever :c
.oO( If you make something that simple so complex, maybe the task at hand isn't the issue )
 
user1804599
@Ven XD
 
I'm kind of surprised there's no find_first_not_of in OCaml's String.
Because this is basically find_first_not_of.
 
user1804599
It's find_first with a negated predicate.
 
Yes. Which is find_first_not_of.
 
user1804599
1:26 PM
Why would you make specific functions for this kind of stuff
this isn't C++.
 
user1804599
also lol string-specific functions that would work on any foldable
 
shush
 
Ven
@rightfold lol foldable in ocaml
 
> Ehrlich, who, at one point, advocated supplying American helicopters and doctors to a proposed program of compulsory sterilization in India, joined with physicist John Holdren in arguing that the U.S. Constitution would permit population control, including limits on family size and forced abortions.
> Ehrlich and Holdren calmly analyzed the merits of various technologies, such as adding sterilants to public drinking water, and called for a “planetary regime” to control population and natural resources around the world.
 
user1804599
@Ven lol OCaml
 
1:35 PM
@wilx Reminds me of SG1.
 
user1804599
git purescript
 
user1804599
purescript may get user-defined kinds some day
 
Ven
@rightfold well school stuff for @ThePhD
 
@Griwes No wonder people in USA distrust any additives to water, even fluoride.
 
Yay, my car should be fixed :D
Fucking finally /o/
 
1:46 PM
@Morwenn Brace for the impact on your purse.
 
@wilx I'm getting used to it.
 
I’m testing stride(i, rng) for strided ranges (e.g. stride(2, rng) for every other element of rng) and I was really wondering why the object file ballooned out of control as I added testcases where the sole difference is the value of i, a runtime parameter
 
inlining?
 
but of course I don’t just pass the result of stride(i, rng) to the test harness, instead I pass in a factory
auto factory = [](auto rng) { return range::stride(1, std::move(rng)); };
multiply for various interesting values
 
And that's a template
 
1:49 PM
woops!
@sehe rather: it’s a unique type which the harness code takes into account (i.e. gets instantiated with)
 
nwp
@LucDanton shouldn't that move be a forward?
 
Polygoric lambdas
 
@sehe no, that’s a feature. stride is tested with a forward-only range, a bidi range, and so on
but there’s a factory for i = 1, another one for i = 2, and so on
@nwp naw
sorry, I shouldn’t have mentioned that i—it’s a meta-variable, not an actual one in my code
it’s a lot of copypasta cos stride(2, rng) will yield different elements than stride(3, rng), given one rng
 
nwp
@LucDanton I'm dumb, that is a copy
also my chat just died for a minute :(
 
mine too
maybe server reset
maybe mini DDoS attack
 
nwp
1:54 PM
blame meta
 
@nwp Why?
Hmmm. I should stop shouting random wordnesses
 
auto factory = [&parameter](auto rng) { return range::stride(parameter, std::move(rng)); };
fixed by turning the parameter into, well, a parameter with just the one factory
 
nwp
1 min ago, by nwp
@LucDanton I'm dumb, that is a copy
 
@LucDanton Interesting side effect of that kind of transformatino
@nwp n.m. I was having a longer connectivity gap. My messages were type way earlier than they arrived on the server
 
Ven
Richard Spencer event. Spencer is the "alt-right" ideologue Bannon built a "platform" for at Breitbart. Bannon soon… https://twitter.com/i/web/status/800087145704632320
nice
 
2:00 PM
@sehe sounds like a keyboard trojan
deer, virus haz u
 
auto factory_for = [&factory, &parameter](int param) -> auto& { parameter = param; return factory; };
I put the spookiness away
welp, that was a lot of time wasted by thrashing the ccache :(
 
@LucDanton what are you working on?
 
@Rerito ranges
 
@LucDanton Someone told me Niebler ranges suck and that the new craze is Chandler ranges
 
@Ven Well, I hope it only looks worse than it is. :(
 
2:05 PM
@LucDanton This particular factory intends to produce a subsequence containing elements parameter*iof the original range?
 
think xs[::i] in Python’s slice notation, if that rings a bell
 
Ven
ew
 
@GundolfGundelfinger sounds like a trap, ask them what they think of Boost.Range
 
@LucDanton And the answer should be?
 
a big laff
 
2:16 PM
> Sometimes I change error messages in other people's code so that users will be offended when they read something like "The start date cannot be after the end date. obviously. idiot."
this site is great
 
@Telkitty I'm a keyboard trojan
 
@sehe You are not a horse.
 
My ghost just took a swan dive of my laptop
 
so imagine an ide
you specify a test
you write code
test fails
what can the IDE do, basing on your code, to help you make it pass
 
nwp
hide the code from the compiler
 
2:29 PM
what if it automatically traced the code used for the test like in the coverage analysis
it could record the whole execution and then you'd be able to browse through it
something like Elm
 
halting problem, no?
test can only fail or run indefinately
 
I am not saying it's supposed to fix the code for you. I'm thinking aids.
 
nwp
unless you are in a weird rightfold domain where the syntax only allows for one possible implementation the IDE will not be able to do anything useful
 
@ratchetfreak but it could automatically gather data when the test fails
@nwp again, look at Elm's debugger
it's just Elm's debugger doesn't know what's your "pass" and "fail" condition. What if it did?
what if instead of setting breakpoints manually, the IDE could draw you a complete call graph and tell you what the parameters' values were at each call?
 
for example with a debugger hooked in to log parameters on function calls, and discard when test passes
 
2:31 PM
yeah, something like that
 
giving a general overview of the running of the test for each failure
 
do you think it could be a useful feature?
 
possible with additional breakpoint set in some loops
 
user1804599
lol in Swift out-of-bounds array access causes SIGILL
 
one thing I'm thinking about is that you could go *backwards8
 
2:33 PM
well most test environments let you rerun just the failed tests (or you can just add a breakpoint to a failing test)
 
Ven
@BartekBanachewicz have you tried Agda btw? Especially its autogeneration code features
 
yeah, but that still requires you to debug in order of execution
 
o_0 my phone just started playing music all on it's own :S
 
what if you could debug starting at the bad value at the end of the test and backtrack to where it originated?
 
Ven
@BartekBanachewicz that's rr+quickcheck
 
2:36 PM
you get a few issues when there is external state to keep track of
 
you should be mocking that anyway
depending on external resources that you don't control in the tests is kinda bad
even then, though, you could examine what the external resource returned for that particular fail
that could be super useful for flaky tests
 
not that great for integration level tests
 
Ven
I know there's some gem in ruby that does it. Called somethingtape or whatnot
 
nwp
why can I not overload on static vs non-static member functions?
 
@nwp what do you mean?
 
Ven
2:39 PM
because the syntax would be ambiguous
 
nwp
struct Foo{void go(); static void go();}; Foo f; f.go(); Foo::go();
 
Ven
i.e. Foo::bar(); inside of a member class: "parent" call or static call?
 
nwp
if an object is available call the non-static, otherwise call the static version
@Ven static
 
but what if you want to call the static version?
 
Ven
@nwp then how do you parent call.
 
user1804599
2:40 PM
lol OOP
 
user1804599
all the complexity
none of the benefit
 
nwp
@Ven you do base *b = this; b->bar();
 
Ven
how about drink some cyanure instead
 
@nwp doesn't work when bar is virtual
 
nwp
wait, that would call the derived, right?
 
Ven
2:41 PM
that's not what the syntax is.
 
nwp
-.
I don't know, I need it in a non-polymorphic context where it would make sense and would be unambiguous, but I guess it doesn't always work out that way and that's why I can't have it.
 
@Ven this->Base::bar()
what am I saying, you don’t need the this
 
Ven
-.-
 
nwp
I'll just call it static_go or something and just roll with it
 
Ven
qu'il est bête.
 
2:43 PM
mais euh
technically not so much a parent call as a static call to a specific base, but you get the drift
 
Ven
except we're discussing why it makes @nwp's proposed feature impossible
 
you can do such overloads and the syntax is not (always) ambiguous
 
Ven
not always
 
user1804599
give crisps
 
so @ratchetfreak @nwp - I couldn't wait and went to the other team in our company that could be interested in making that a part of our product. Turns out the idea has been suggested some 6 months ago and it's in the backlog.
yay, I guess.
(we do software monitoring)
 
nwp
2:55 PM
just hope "backlog" isn't just a graveyard for ideas
 
the hard parts of that is going to be selecting interesting bits of data to log, the remainder should be simple
 
that's doable if you know what you're monitoring, e.g. code inside a framework
 
3:12 PM
hmfph
if a:
   thing()
elif b:
   log()
   thing()
 
Ven
nice indent
 
either my brain is dying or this is somewhat convoluted
 
Ven
if b:
  log()
thing()
 
not the same
 
Ven
ok
 
3:14 PM
if a ~ false and b ~ false then thing won't get run
 
if b:
  log()
if a or b
  thing()
 
can't ping from code block
 
Ven
^
 
anyway yeah that's more readable
but...
not the same
 
if a or b
  if b
    log()
  thing()
 
3:16 PM
I like how it's deceptively simple yet so annoying to get right
 
Ven
if !a and b:
  log()
if a or b:
  thing()
:P
 
it's fizzbuzz all over again
 
Ven
horrible
 
yeah last rf's solution was the most edible I guess
but I think that's still not good enough. Maybe I need an ADT which can contain both
 
3:17 PM
or just an enum really
 
/cc @Mysticial
 
then I could do
 
Ven
@Borgleader self-deleted at least :P
 
oh wait that doesn't help unless I do falltrough in switch
hgngj
 
Ven
This is one of our ctors:
Foo::Foo() : _var(_var1) {}
wtf
 
3:19 PM
~C++~
oh wait lol
where does the param come from
 
it's another field I think
 
It's not a param.
 
Ven
it's just a field from the parent
 
@ratchetfreak in a=true and b=true this will still log, but wouldn't in the first case
 
user1804599
 
3:21 PM
is the not-logging when a important?
 
@ratchetfreak yes. The log says "doing thing despite not a"
IOW "a" is the regular condition, and "b" is kinda fallback but also optional
 
if a or b
  if not a
    log()
  thing()
 
Ven
mine works as well :(
 
            if complete or config_info.fast_id:
                new_config = config_info.config
                fast_check_id = config_info.fast_id

                if not complete:
                    logger.info("performing fast_config even though config is not complete")
that's the real code
 
3:24 PM
then my version makes a lot of sense
 
the whole codebase is a huge state machine
it's littered with puzzles like that
I mean the logic is actually quite complex so that's not necessarily bad
but it's not super easy to grasp either
 
time to make state diagrams?
 
yep.
I'm also considering flipping the logic and making the states classes
instead of enum values
so that the logic could be inside of the state, not around it
ugh my MSDN doesn't have Visio
damn it
 
3:43 PM
-                return [program = std::move(program), expected = std::move(expected)]()
+                return [ program = std::move(program), expected = std::move(expected) ]()
clang-format going full retard. -.-
This might've been caused by SpacesInContainerLiterals: true. Still full retard tho.
 
Sigh... you know you are bored at work when you are basically implementing Java 8 features for Java 7
 
so I googled "how to create a constant in python"
"Just don't change it" isn't helpful at all. It doesn't answer the question and I would suggest that it is removed. — Bartek Banachewicz Mar 8 at 14:26
fuck's sake
 
I'm gonna start using "pythonic" as a synonym for "dumb" soon
 
there's dumb people with every langauge
 
3:51 PM
in python they look at a dumb thing and think it's fine just because they call it "pythonic"
@thecoshman now if that's representative of the community then it's way more than just "there's some dumb people"
 
nwp
@BartekBanachewicz they call it fine because that is the best you can do in python and changing the language is out of scope
 
that doesn't make it fine in the slightest
it's just equally as bad as it was
and saying "just don't change the value" is missing the point by a Mun orbit
 
nwp
some people take comfort in knowing they did the best possible thing, others try to change the world
not sure which one is right
 
"we picked a dumb language and then did the best possible thing in it"
is that how they justify it
 
nwp
Yup. Except they think if python/c++/whatever did it it can't be that terrible. Probably an authority fallacy or something.
The alternative is to fail at creating a better language and never get anything done, so arguably they are choosing the right path.
 
Ven
3:57 PM
"if you catch an exception in a callback [child thread], just rethrow it in the thread that launched it"
trying to debunk this at work atm :P
 
@thecoshman If I had to use Java (at all) I wouldn't be bored--I'd be ripping my hair out (because I used one of Microsoft's templates for my resume, and editing it is seriously painful).
 
@nwp you don't need to create a language
you can just use another one
 
nwp
there you go, should work for your use case as well
 
@JerryCoffin make a new resume then
 
it seems the only way this industry can get anything done is with stumbling over the broken tools it has produced
 
3:59 PM
@JerryCoffin what do they have to do with each other o_0
 
that's so freaking sad
 

« first day (2229 days earlier)      last day (2734 days later) »