« first day (1593 days earlier)      last day (3354 days later) » 

10:00 AM
Amen.
 
1
Q: find the each number of 4 digit of user input and count it using recursion

NumbNutsI have with my code. This is about recursion. I have to create function digitAppear( int findDigit, int value) where value is the user input, and findDigit is single digit number ranging from 0 to 9. The function read user input and return each digit number from the user input and count how many ...

> I have with my code. This is about recursion.
Sounds like a wise man.
 
user3010322
@ParkYoung-Bae Fuckin' AMEN.
 
:(
"C:/Program Files (x86)/Git/bin/sh.exe": -c: line 0: syntax error near unexpected token `('
 
@ThePhD It's either "fucking a man" or "fucking men".
 
this again
sigh.
I'll never understand this.
 
10:02 AM
@BartekBanachewicz looks like dr crane from batman.
 
@Rapptz I think it's supposed to be funny or something.
 
@FredOverflow Heh - I upvoted a Vlad comment.
 
Send help.
msys2 is actually required to build OpenSSL
 
@MartinJames inb4 random downvote
 
@Cinch For what it's worth, Go is no longer implemented in C anymore.
 
10:15 AM
@FredOverflow Congratulations, you just beat @LightnessRacesinOrbit. I think @MartinJames owes you a beer right? :p
 
Is there something like nameof(some_symbol) which would yield "some_symbol"? (à la C#) Or do I have to resort to a macro.
 
I am only aware of the # stuff in macros
 
hihi answering question with haskell because no language tag
#justbartekthings
 
@ParkYoung-Bae I've seen something like that in Boost
 
@ParkYoung-Bae Yeah, pasting macro.
 
10:19 AM
@AlexM. Yeah, BOOST_PP_STRINGIZE (macro)
 
It takes care of macro expansion before pasting so you may want to have a look at its insides. #define PASTE( x ) #x only expands once or something like that.
 
Just another indirection is needed.
I can't build OpenSSL because of spaces in my path.
I don't know how2fix.
 
#define DO_PASTE( x ) #x and #define PASTE( x ) DO_PASTE( x ) it is then!
 
@Rerito @AlexM. won the beer yesterday, just beating out @πάνταῥεῖ
 
no I didn't
 
10:21 AM
Oh dat latency of mine
 
@AlexM. Oh.. I thought it was you:(
 
nope
 
@MartinJames was Andy
 
@BartekBanachewicz Billhooks. I must make a diary note, else every unconferencer will be after a beer:)
 
Xeo
Was @πάνταῥεῖ, according to the log
 
10:25 AM
@Xeo Winner HAS to attend unconference to get beer:)
 
Fuck.
MinGW builds isn't multilib enabled :(
 
imagine me attending the unconference
 
and you discovering that I don't own a tshirt with a pizza drawn on it
~revelations~
 
@FredOverflow Welcome to .NET 4.0 Javanists. Also, I don't think the problem is inherent, because there's no such issue AFAIK on .NET BCL's File.ReadLines Method
 
10:36 AM
I want a CS GO tshirt but all XL sizes are out of stock :(
 
@AlexM. The junk food is getting its revenge
 
@sehe When does the closing happen?
 
@sehe nah I'm wearing XL since high school
I also lost weight lately btw
 
@LucDanton The enumerator is IDispose-able, so assuming for-each loop, the dispose is implied to happen deterministically on exit of the loop
@AlexM. Good
 
@sehe Well the 'non-inherentness' is the loop then isn’t it?
 
10:39 AM
Oh well. You mean "people forget to use using()"?
 
If you write it out yourself but without the disposing, don’t you risk the same as well?
@sehe What if 'people' write a collect-like method? How do you dispose of sink arguments?
 
@LucDanton With a plumber, naturally.
 
@LucDanton I'm not sure I see the picture, but in C# you'd simply make the composing class disposable and DoTheRightThing(TM)
 
While this answer has a ring of truth, I am unable to confirm that this poster is, indeed, Brian Goetz. Of note, the profile indicates that this person has only posted this answer and hasn't participated in SO in any other way. His profile contains no information and lacks anything that would grant this post additional authoritativeness. I would recommend interpreting with caution. — scottb Aug 15 '13 at 21:04
I could get my mother to write a note... — Brian Goetz Jun 17 '14 at 16:30
lol
 
@LucDanton Yeah. I bet the same goes on many platforms.
I mean writing the naive readlines input iterator in c++ (e.g. using boost::make_function_input_iterator over [&](){ std::string line; getline(stream, line); return line; }) you'll end up wrecking the heap pretty badly and having abysmal performance just the same
 
10:43 AM
@FredOverflow care to take a look at my doubt (kind sir)
 
@sehe In the original Java, the OP wrote no loop per-se in the snippet of interest. The loops you see are there to trigger the 'too many files' condition (or so I presume), to mimic a long-running program. So where do you figure the API should take care of disposing?
 
I'm split between: auto loader = FooFileLoader("data.txt"); auto foos = FooConsumer(std::move(loader.foos()); and auto foos = FooConsumer(FooLoader().from_file("data.txt"));
 
@LucDanton Mmm. I was never defending any Java implementation aspect. Perhaps we're talking past each other a bit. I was suggesting that "GC doesn't cut it" isn't inherent (given the similar API on .NET can work)
 
@ParkYoung-Bae FooCollection? wtf
 
@sehe It is my position that yes, this is exactly inherent to the ambient language.
 
10:46 AM
why not auto foos = loader.foos()?
 
@BartekBanachewicz I'm simplifying, it's nost just a collection.
 
loading things is boring
 
@BartekBanachewicz oh yeah lol :P same difference, did what I want
 
@LucDanton Unsure whether you're trying to agree with me then, or opposing (it "sounds" like the latter, but maybe I'm too insecure about my English abilities)
 
And if you wrote a collect in C# you’d run afoul of the same issue: an API that invites you to do seq.collect() where you should be doing using(var seq = init) { return seq.collect(); }
 
10:47 AM
@thecoshman just pass that matrix to drawBox, srsly
 
Ok. That clarifies
 
accepting a function that can have arbitrary side effects is scary as fuck
 
@LucDanton Doesn't that mean that the API interface is mostly at fault?
 
if you could mark it pure mat4 fn() then maybe
 
@BartekBanachewicz well if I was calculating what the model matrix was, I may as well set that, rather than passing it in.
The lambda was so that the function can set the shader uniform without having access to either the shader or the uniform location.
Really I should have made a class that I pass in that has a "setModelMatrix" function.
 
10:49 AM
@ParkYoung-Bae Can the loader load from things other than a file?
 
@sehe I don’t know, not knowing the languages enough. Since you do, I was wondering (re: non-inherentness) what it is an API and a user should so, should they want to collect?
 
It seems similar to how a lockfree container with a size() method invites race conditions. Well, good api provides non-racy functions for essential operations (and optionally overloads with stronger guarantees depending on what the user requires)
 
@AndyProwl ATM no, eventually it shall. Hopefully.
 
@thecoshman that you pass a matrix you mean
 
@LucDanton I don't have experience with the collect style (stuck with Java 7 here)
 
10:50 AM
I'll ask differently
 
do you know what const function in Haskell is doing?
 
@sehe Sometimes distinguished as fast_size()
 
@BartekBanachewicz yes
 
@ParkYoung-Bae That's also a good approach
 
10:51 AM
I'd argue you want the slow, correct one by default
 
@thecoshman exposing higher-order accessors is a good idea, but when you need both a setter and a getter
 
ie I would have some class that represents the 'render engine state stuff', a draw function would take one of those and want to set properties of the render engine
 
in your case you really just want to put the matrix in
 
Then I don’t see how your claim '.NET doesn’t have the problem' works. To 'How can I do X without leaking my fds', I won’t accept the answer 'Well I don’t do X'.
 
@thecoshman ew stateful apis
 
10:51 AM
Ok, officially dividing my attention too much.
 
@ParkYoung-Bae Well in that case the first version would be awkward (you're passing the name of a file to the constructor, but then the loader might load the stuff from something else than a file). In the second case, though, I'd be concerned with the loader having too many responsibilities: know how to load from a file, know how to load from a DB, etc.
 
@thecoshman why don't you simply make a function that takes what you want to draw and draws it
 
@BartekBanachewicz no, I don't. The 'drawBox' function does not need to matrix it self, it either produces and wants a way of telling something else to use it, or have it set for it.
 
how about that
 
@LucDanton Well, even C++ has the problem if you implement the flawed design... My point is that GC is not inherently causing this. Apparently GC caught some API designer out here
 
10:52 AM
@thecoshman this sounds like an unnecessary complication. drawBox should draw a box.
 
@AndyProwl Then, if I make FooFileLoader("file.txt)" and later have auto FooConsumer(std::move(loader.foos())) does it seem shocking to steal the resources of the loader?
 
@sehe Yes, so tell me what non-flawed design you adopt.
 
ideally, you'd abstract the box part and have draw (transformationMat, box)
it's as simple as it gets
even better, draw (program, transformationMat, box)
 
@ParkYoung-Bae Not sure I follow. Also, what is foos() returning? A vector? the move() smells
 
@AndyProwl A vector yes. The collection of loaded foos.
 
10:54 AM
@ParkYoung-Bae By value?
If so, you don't need the move
 
There's unique_ptrs inside though
 
I don't think you get my approach to this... I am not trying to hide away for months and reveal a perfect blob of code. I am incrementally developing it.
 
@sehe I agree it has little to do with GC (formally speaking; culturally/historically that’s different), but it has to do with other features (which are culturally linked). But I’m curious to see what C# features is going to get us out of this rough patch. (And I know how C++ can, barely.)
 
@LucDanton The one in .NET. Yes. My answer really does boil down to "GC does not favour certain styles of API". It's nothing strange actually.
Given GC, you will have to keep thinking about hooking for deterministic disposal in case you act on types that require/support it. Of course, people will forget this, and that's probably where you will say that RAII and deterministic destruction is superior (because you get the hooks implicitly at the core language level)
 
Don't get me wrong, I appreciate the input.
 
10:55 AM
@ParkYoung-Bae If your function looks like std::vector<std::unique_ptr<Foo>> FooFileLoader::foos() you don't need the move(). The vector is an rvalue
 
@BartekBanachewicz I'm not a type theorist. I'm a type pragmatist.
 
@thecoshman the approach is one irrelevant thing. The fact that your api is weird for whatever reason is another.
 
hola
 
@sehe Okay so how do I collect in .NET?
 
@AndyProwl Oooh that's right, thank you
 
10:56 AM
np
 
When rightfold comes back from his heoric type quests and tells his stories by the fireside, more often than not I have no idea what he's talking about.
 
Wait. There's no move in my code actually :D
 
lol
 
@FredOverflow I was actually thinking if I can implement that in Haskell
 
@LucDanton I'd have to read up on what it actually does. Sorry.
5 mins ago, by sehe
Ok, officially dividing my attention too much.
 
10:56 AM
@ParkYoung-Bae Also, does the loading happen in the constructor, or when foos() is called?
 
@AndyProwl With the FooLoader(string) it happens in the constructor.
 
@ParkYoung-Bae Then I guess you may also consider having an abstract FooProvider interface with a foos(), which is implemented by FooFileLoader and possibly other loaders which retrieve the Foos from a different source.
 
@sehe Wouldn’t we have avoided much trouble if you had mentioned that early? Because the Java API 'roughness' is entirely focused there. For all the foo().bar().qux().blah().collect() original chain, you can boil down the problem to seq.collect() where seq is the Java equivalent of IEnumerable<T>. Put another way, how do I go from IEnumerable<T> to Array<T> (Or T[], not sure how it’s spelt) expressively, concisely and disposively?
 
Clients would then receive a pointer/reference to FooProvider and ignore the deserialization details. Whether this is viable or not depends on your concrete design though
 
There is currently no design, I'm refucktoring a library (so far it's two-phase-init everywhere, the foos load themselves).
 
10:59 AM
@LucDanton I believe that is true of the article, but I was responding to the summary line in chat:
 
I see
 
Again I appreciate your input :)
 
Also, I did mention that I lacked interest experience with the collect() stream API pattern
 
No prob
 
11:01 AM
@LucDanton I believe that var yay = File.ReadLines("test.txt").ToArray(); is perfectly cromulent
 
When is the file closed?
 
hmm maybe I could use type families
 
@LucDanton sheepish grin. I suppose it's not unless you go and say using (var lines = File.ReadLines("test.txt")) yay = lines.ToArray();
 
Enough intense pseudo-reflection for today, time to go home guees
 
11:03 AM
GC doesn’t cut it, and you can’t have an API that saves your user. All of this inherent to the language design.
 
Oh well. I think these pitfalls are chump change compared to the plethora of pitfalls that the C++ programmer has to navigate
 
Go no, not that one; just Rust!
 
OpenSSL is the most annoying thing I've built on Windows.
It's actually taken me a bit over an hour.
 
<interactive>:13:10:
    Data constructor `RF' comes from an un-promotable type `R:ReportPossibleFail'
    In the type signature for `x': x :: RF String
what the
I feel like on a very thin ice
and i'm high on caffeine and type theory
someone stop me
 
 fatal error: e_os.h: No such file or directory
:(
 
11:06 AM
@LucDanton Interesting. I'll have to figure out why my intuitive response was that GC is not to blame... The way you summarize it, indeed confirms that we need more than just GC. That's subtly different from blaming GC...
So. I subconsciously transformed "GC doesn't cut it" to "GC is to blame for this issue". When in fact it was more about "Lack of hooks fro deterministic resource destruction is the issue". Which is indeed completely the case
 
@sehe Yeah. It stems from a combination GC/share-everything. Anything that looks like R i_eat_my_arguments(Foo f); // Foo is IDisposable puts a burden on the caller.
If you have a mechanism to pass down responsibilities to the callee you can slap a GC on everything and you will not have anything to blame it for.
 
> Type families provide a more functional style of type-level programming than the relational style of functional dependencies.
 
@BartekBanachewicz I'm playing around vOv
 
@thecoshman blindly?
 
11:20 AM
What is a great book to learn OOP?
 
Mmh, taking the conclusions of the previous discussion to its logical end: should an istream_range close its own basic_[i]fstream on end? It can work as a good default, where you can upcast the fstream to just stream (which can’t be closed) if you want to keep the file open. @sehe @FredOverflow @Rapptz
 
@Elvisjames I liked OO Analysis And Design
 
why is make executing g++ instead of gcc :(
 
@Elvisjames I liked programming
 
g++    -c -o cryptlib.o cryptlib.c
 
11:23 AM
hmpfh
 
@Rapptz cos u told it to
 
I absolutely did not.
 
@Elvisjames Are you looking for a language-independent OO book?
 
I've been at this for almost 2 hours.
Shh.
:(
 
11:24 AM
what're your rules
 
The Makefile is generated.
 
other than no fighting in the Lounge
 
This isn't my project.
 
don't care. what're your rules
you can't debug it without a testcase bub!
 
@FredOverflow No probably c++
 
11:26 AM
hmmmmmhfpghj
 
@LucDanton I don't see how an upcast is going to work since you can't copy a stream and if you cast a ref or pointer then the original fstream destructor will run anyway
 
# default
COMPILE.C = $(COMPILE.cc)
 
well, unless they have no virtual dtor
 
jlkajsdka
 
and then it's just UB
 
11:26 AM
what the fuck is this
 
so data families are injective
 
That’s just super. Superset, even!
 
in that you can get from a data family instance to the data family itself
but you can't do it with type families
 
gahhhhhhhhh
so frustrated
 
We're watching @Rapptz die in slow motion
 
11:27 AM
@BartekBanachewicz Head First Object-Oriented Analysis and Design?
 
aaaahahh so type families really are "type functions"
@Elvisjames aye
 
this is a practice with class, which can serve as a template to all!
 
type Family nameOfAlias nameOfDest
and then the instance
takes a type and returns a new type
that can be some totally other type
OTOH, for data families, it creates a new type
yes!
I think I'm getting it
 
Why would make be using $(COMPILE.C)?
idgi
 
maan
this could be really useful in Hate
 
11:34 AM
alright, imma sleep.
Another day.
 
@Elvisjames C++ must be one of the worst languages to learn OOP.
 
@FredOverflow Could you suggest a better one?
 
I have never programmed in an object-oriented language, but I have heard good things about Smalltalk and Newspeak.
 
@FredOverflow you said about Java too
 
Java is one oft the worst languages regardless of paradigm.
 
11:37 AM
use C# noob
the best language in the world
because I use it
 
8
Q: Java has the JVM, what does C have?

scerrecrowI know that C has a compiler but what determines execution performance? For example in an if else block, what if the code just had all ifs instead of if elses, what determines that all the ifs will be ran? In Java it would be the JVM, but in C what is the execution compiler thing?

wat
 
@FredOverflow er
 
It's, um, your computer!! That's its purpose. — Lightness Races in Orbit 22 secs ago
inb4 "yes but he's asking what on the computer"
inb4 morons
 
yeeaah
I think I understand data/type families
 
11:47 AM
Have you already planned a type family reunion?
@Elvisjames It asks whether you want to join the Lounge Game Jam.
It's a competition to program a game based on a given theme in 24 hours or something.
 
@Elvisjames it's a poll
@FredOverflow @Elvisjames it's not a competition, and the time limit hasn't been chosen yet
 
Why would I compete if it's not a competition?
 
@FredOverflow we award titles, but you can participate without competing
 
@LucDanton upcast sounds iffy there since it implies runtime polymorphism, but yeah. I believe that Boost IOStreams becamse unwieldy with their chosen strategy to solve this
 
@Rerito you're massively late
 
11:52 AM
> The Get To Work expansion pack for The Sims 4 will let you micromanage your Sims through various careers, including doctoring, sciencing, businessing, and, as shown in the latest trailer, detectiving.
 
21 hours ago, by Lightness Races in Orbit
FUCK
 
@Elvisjames it's a hyperlink to a google-docs backed form poll
 
True, and I don’t feel like spending time writing a stream concept either.
 
for so many years, The Sims required an expansion pack to add jobs
 
@sehe I may simply use a bool close_at_end; member.
 
11:53 AM
> Get To Work will cost £30 / $40, which seems like rather a lot.
 
@LucDanton is this old 2012 answer from you still the way you would code it now, or does C++14 offer anything to simplify the index/tuple dance a bit?
 
yeah it is a lot since it will take 10 more expansions to get Sims 4 to have the content of Sims 3 after its own 10 expansions lol
such a weird series
 
@FredOverflow tempting: "C has buffer overruns"
@LucDanton It can become tricky to know who's in charge of this flag. Again, the burden should be on the caller. But some library might view itself as "the caller" making composition a pain (like with stream states)
 
@TemplateRex I use the stock Standard indices. That being said, I still have a handful of (meta)functions for e.g. generating them in an ADL-friendly manner. So indices_for<Foo>() is my own thing, but the result is some std::integer_sequence<…> which serves as a lingua franca.
 
@glglgl As it is well-known weak programmers form the majority. Even American president Obama said not so far in fact that he loves americans though there is the majority of idiots among americans. in USA:) — Vlad from Moscow 18 hours ago
 
11:56 AM
@sehe Well such a range is going to be move-only (streams are not copyable, with good reason) so that seems fair enough.
 
Then again, I vouch for the simple flag as being a lot easier to explain and reason about than the mess in Boost IOStream
 
@LucDanton Good point. I guess I'm still not completely attuned to all the goodness of move-semantics vs. API design
 
no real conclusions out of that
 
Xeo
11:57 AM
@TemplateRex There is the logN way, besides the linear way
 
> I want a long [6]
excellent
 
maybe we could make two categories, "long" and "short"
 
Xeo
but that's only for index generation, which is now covered by the standard as @Luc said.
 
@Xeo logN in implementation of integer_sequence you mean?
 
revolutionary
 
11:57 AM
say, one spanning 3 days, and the other being a fixed 5 hours
so that on sunday we'd get entries from both
 
Xeo
@TemplateRex make_integer_sequence, to be specific
 
@LightnessRacesinOrbit we need the literals for imperials:
> She wants the long[7inch]
 
@LucDanton tnx, I'll look into it. BTW, do you also still use the WithValueCategoryOf wrapper, or do you rely on the _t convenience wrappers?
 
@BartekBanachewicz I can spent?
 
Xeo
... adds newline ... sees IntelliSense reparse ... EVERY SINGLE TIME ARGH
 
11:58 AM
@Elvisjames ffs should be "spend"
 
and "might as well"
 
@Xeo I think libc++ has logN, and libstdc++ has ON
 

« first day (1593 days earlier)      last day (3354 days later) »