« first day (2498 days earlier)      last day (2436 days later) » 

12:24 AM
Learning asynchronous programming is more important than learning multithreaded programming.
 
1:13 AM
shouldn't pay too much attention to multithreaded programming when your single thread is crashing
 
i hate the way C# conflates asynchronous functions with its task-scheduler/thread-pool
makes it hard to know whether you've written single-threaded code or multi-threaded code
 
 
1 hour later…
2:43 AM
I didn't want to write to much to make it sound complicated
 
 
5 hours later…
7:31 AM
8 messages moved to bin
 
7:50 AM
@Puppy That doesn't seem realistic, but I guess lots of programmers do return x[2]; by accident.
 
@fredoverflow Well, it was clearly a simplified example ;p
 
8:37 AM
so
I hooked up my new Onkyo and now I want to buy decent speakers for it
recommend sub-$300 5.1 sets ITT (used)
Oh hmm there seem to be 7.1 sets with front high actually separate from floorstanding front
this looks cool
 
I want money too
 
have you tried working
 
I am working. They pay me shitty trainee money
But they are goign to pay me for doing my masters thesis so I guess thats ok
 
ugh colours "dark wood"/"even darker wood"/"black"
FFS
@Horttanainen that doesn't really happen around here
 
@BartekBanachewicz This is a "Bonus" for working here for a year.
 
8:46 AM
you pretty much pay for yourself
 
@Telkitty pretty much so yeah
 
there are some companies with great benefits but general low pay
 
I get 18 euros per hour
 
still beats the ones with low pay and no benefit
 
TIL there are way too many things involved in overload resolution. That's scary o_o
 
8:49 AM
@Horttanainen that's more than I earn here
see that's the benefit of not living in 2nd world
> shitty trainee money
 
Well I get 1/3 compared to other people here
no, half
 
where do you live again?
 
Finland
 
@Morwenn that first graph ... overload resolution is O(n^2)?
 
I guess I earn a bit less that people working on the same things in my office. But that's mostly because we aren't employed by the same company.
@ratchetfreak Looks a bit like it.
 
8:55 AM
@BartekBanachewicz I needed to check that again. I get 17.5 per hour. Prior tax
 
@Horttanainen so what's that net? Taxes are high there right
 
yeah
 
I have a complex tax situation but it's around 16-18%
 
nwp
@Morwenn Are you aware of a proposal that extends deduction guides to allow more than one user defined conversion? Something like having constructors A(int); B(A); C(B); and making C c(42); compile by specifying C(int) -> C(B(A(int)));.
 
@BartekBanachewicz I have no idea what is the net. My paycheck is complicated as hell. I will have to get my calculator for this shit
 
8:59 AM
@Morwenn but now the real question is, is that a spec-mandated O(n^2) or an accidental one...
 
@BartekBanachewicz my basic tax is 16% but it is more like 19.8% if I take into calculations are the other stuff in the check
 
@nwp I'm not aware of such a proposal.
 
nwp
Ok, thanks.
 
@ratchetfreak Not sure. I know that compilers try to avoid O(n²) algorithms, but maybe the spec implicitly mandates some. I have indeed heard tales of O(n²) overload resolution back in the day.
 
C# OR in some cases with delegates can be O(2^n)
 
9:07 AM
o_o
 
if you have a lot of 'or' operations in parallel, maybe consider replacing it with a 'switch' statement
 
@Telkitty I laughed at yours and raise you this:
1920x1080 is good enough for me, so I declare it the overlord resolution.
 
had to teach a colleague the difference between overload and override recently
 
I keep forgetting the words in French.
 
In finnish baguette is patonki. For a long time I thought that "le patong" was french for patonki
 
9:20 AM
xD
 
@Horttanainen What does "le patong" actually mean?
 
@fredoverflow nothing. It just sounds very french
 
@Puppy Too bad those words sound so similar. We have the same problem in Germany (überladen vs. überschreiben).
 
There aren't that many French words ending in « -ong » (there are like 15 of them, mostly taken from foreign languages), so « patong » looks more Chinese to me :p
 
well "le" certainly makes it french enough :p
 
9:29 AM
the guide to making shit french: Just add "le" in front
le your face
 
I've found a list: there are apparently 14 French words that end in « -ong », only 3 of which have latin roots.
 
@Puppy May I ask how you explain the difference between two concepts that are basically mostly (completely?) orthogonal? :)
 
well not really
they're not that dissimilar
you've got multiple functions and then you pick one of them to call
it's just that one of them is based on argument types and one of them is based on object type
 
compile time vs. runtime
 
which you could argue is just overloading on the type of this
 
9:37 AM
@Puppy How do you feel about languages that don't provide overloading because it's "too dangerous/complicated" (or other reasons)?
 
how is overloading dangerous?
 
@fredoverflow overloading does create a lot of hidden complexity, especially once things stop being done in a single compilation unit
 
please explain?
 
@Telkitty Programmer expects overload A to be called when in fact overload B gets called. Maybe overload B didn't even exist when the call was written but was added later. Something like that.
 
@fredoverflow Pretty dumb
 
9:43 AM
I would expect compiler to complain when wrong parameters are supplied
 
I won't pretend that OR is the simplest thing in the world or that it can't be taken too far but there is a basic level which is not complicated or dangerous at all
 
@Telkitty So no implicit conversions? Some modern languages choose that path.
For example, Kotlin has overloading, but no implicit conversions. If a function expects a double, you can't pass an int, you have to convert explicitly.
Ceylon has neither overloading nor implicit conversions.
 
having both implicit conversion and overloads required that you consider what should happen for foo(1,2) for overloads foo(double, int) and foo(int, double)
 
@ratchetfreak C++ compiler complains with "no best match" or something
 
yeah most (if not all) will error with ambiguous
but it needs to be implemented
 
9:47 AM
Now imagine the first overload was written 5 years ago, and the second overload was written yesterday...
Now some clients won't compile anymore.
 
depends on the implicit conversion: converting int to double seems reasonable, rounding double to int tends to be more erroneous
 
What about int to float?
 
float -> double (ok) double -> float (lose precision)
 
Oh wait, we're talking C++ where int can be 64 bits, so even int -> double can be lossy.
But int32 -> float is easier to understand. The integer 16777217 is not representable in the set of floats.
 
then there is also function pointers, when taking a function pointer from an overloaded function which function do you get? and how to force getting a certain overload
 
9:53 AM
Let's use decimal floating point numbers then :p
 
@ratchetfreak that's like asking what if you dynamic_cast something to a wrong object
 
long long a = 1LL << 53;
long long b = a + 1;
double x = a;
double y = b;
printf("%lld\n", a);
printf("%f\n", x);
printf("%lld\n", b);
printf("%f\n", y);
9007199254740992
9007199254740992.000000
9007199254740993
9007199254740992.000000
               ^ LOL 2
@ratchetfreak In C++, you would use a cast to disambiguate.
 
 
2 hours later…
11:29 AM
hmpfh
 
say, I have the following situation: method A calls B, which calls C, which calls A again for some reason — how do I call this situation in common English IT language? "call loop"?
 
mutual recursion
 
too long
 
try hungarian notation
mt_rc
 
the context is RPC calls, and I need to produce meaningful error to server logs, when it sees shit like this
 
11:35 AM
just tell them that A called B which called C and for some reason C called A and this is why you are reading this error
 
it would be hard to parse in a cloud log aggregation part
 
In here these errors are abbreviated as "error"
 
it's an error as well, but I need to come up with a meaningful term to describe this shit, can't think of anything better than a "call loop"
 
well mutual recursion is the word
 
it's not a() -> b() -> c() -> a() in terms of functions, true recursion is happening very rarely there, I need to specifically name this behavior and nothing else :)
 
11:43 AM
Go for call loop then. I cannot think anything better than mutual recursion for the situation you described
 
@login_not_failed mutual recursion
@Horttanainen oh well
 
nwp
@login_not_failed How about "normal"? There is nothing wrong with that situation and it is not necessarily a loop.
 
@nwp "error! There was nothing wrong with this situation."
 
@nwp it's definetely not normal: on a very high load these scenarios often lead to spectacular crashes, when on some groups of servers there are suddenly no more space to plug in another RPC-call
 
It's not just that. The first thing that caught my eye was #include "listnener.h". Help us help you: make a SSCCE. See also kera.name/articles/2013/10/nobody-writes-testcases-any-moresehe 11 secs ago
@login_not_failed tree recursion, indirect recursion, cyclic dependency, call cycle
@login_not_failed Depends. If the calls are unconditional, then it's a definite bug. Otherwise: design your system as required
 
nwp
11:59 AM
@login_not_failed Do you want to enforce a node hierarchy?
 
Possibly. I'd guess it's a lazy data dependency gone wrong. Same problem as with event-driven UI code.
 
@sehe "call cycle" is the best name so far, thanks!
 
It comes from "call graph". A cycle in a graph means it's no longer a DAG
 
@sehe it's a very-very large system with lots of people using our SDK, so they will get hundreds of error tickets when my improvement will be done :D
 
As with any recursion, if there's no bottom-out then it's infinite
@login_not_failed Physically cringe, hiding my head under the desk
 
12:15 PM
I cringe when I see how these developers get tens or hundreds of error tickets per months, when I have a few, and often they are not even mine (not talking about tasks), it's a pure mess :D
 
@login_not_failed It's called "re-entrant"
in the most literal sense, you re-enter function A.
 
12:28 PM
@Puppy thanks!
 
12:52 PM
@login_not_failed bad design
@login_not_failed watch for A() -> B() -> C() -> [A'(), A'(), A'(), +]
I had a bug when a hook was perpetually added in a chain call modiyfing a search function to search in all possible languages... At least it wasn'T purely cyclic just getting way way more complicated to process
 
@LoïcFaure-Lacroix the problem is more complex than my example, but thankfully your example isn't an issue
 
I hope so, if your code start calling itself multiple time as a cyclic tree then you'll get out of memory very soon
btw, if you want some other ideas, indirect recursion, cyclic call
 
1:14 PM
recursion always consumes memory like mad, that's it's hardly used when writing everyday software
 
@Telkitty wrong
 
50+% of the chance, you will use it in a exam or interview situation
 
@LoïcFaure-Lacroix it's an evnironment with a true, large scale server farms, true RPC calls, with multiple groups of servers indolved, when BL method comes to some server, it comes with a bunch of parameters, so it most likely have a TTL set, in example, — so this problem occurs when servers under a very heavy load, when a server have no more capacity to handle that extra -> A()
 
@Telkitty recursion as in iterative process doesn't consume more memory as it is in some way just a goto
 
When you've got a double recursion (quicksort style), transforming it into an iterative process without manually filling a stack is rather difficult.
 
1:20 PM
when I talked about memory, I really meant about stack, as in recursion, memory usage gets pushed in stack, which is not the case for loops
 
@Telkitty well, if you have TCO, you don't consume more stack than necessary, that said, yes not all language support TCO
 
@Telkitty There are different kinds of recursions and different kinds of parameter passing.
 
@LoïcFaure-Lacroix and TCO is not always possible
 
@ratchetfreak in the case TCO isn't possible, it also means there is no way to do it without recursion
 
@Horttanainen different kinds of parameter passing ... like what?
 
1:24 PM
@Telkitty pass by name , pass by value. I do not remember the correct term
 
@LoïcFaure-Lacroix all recursions can be written in loops
 
@Telkitty I think he's referring as Iterative Process vs Tree Process
@Telkitty if all recursion can be written in loops then all recursion can have TCO... I sense someone is wrong
 
TCO is a very specific way of converting recursion to iteration
with a strict precondition (nothing happens after recursive call returns)
@LoïcFaure-Lacroix see my answer over on SoftEng.SE
 
With each recursive calls, memory of calling function gets pushed into stack. When it's completed, the memory gets popped back regardless whether is passed by value or reference?
 
@ratchetfreak I'm quite aware of this
 
1:32 PM
@Telkitty forget about the parameter passing thing I mentioned
 
@ratchetfreak Tellkitty said that all recursion can be written in loops. If it was true we could have a TCO version of any loop which goes against what you said: "TCO isn't always possible"
 
@Telkitty I meant are the parameters passed by thunks or are they evaluated before, but later I realized that it would not make difference here.
 
It's hard to prove that any "tree" recursive process can be rewritten as iterative process
 
nwp
@LoïcFaure-Lacroix How does that follow?
 
My point is that his argument that TCO isn't always possible is irrelevant as if it's not possible to do TCO it also means the algorithm cannot be written without recursion
 
1:37 PM
@LoïcFaure-Lacroix TCO is not the only way of converting recursion to loops
 
2
Q: Traversal of Binary Search Tree via loop instead of Recursion

user3272998Hey does anyone know how to traverse a binary search tree using loops instead of recursion? I have the recursive method public static int countMatches(BinaryNodeInterface<Integer> tree, Integer key) { int matches = 0; if (tree != null) { if (tree.getData().equals(key)) ...

 
nwp
@LoïcFaure-Lacroix You can always trivially convert recursive algorithms to non-recursive algorithms by simulating the recursion with a stack.
 
@ratchetfreak if you can convert recursion into loops you will have TCO anyway
 
nwp
Lol edit war. The code is so bad neither C nor C++ want it.
 
1:53 PM
The way to do YT feature vids
 
2:13 PM
 
2:48 PM
shameless bear is shameless >_<
 
 
1 hour later…
Ven
5:13 PM
Hi
@Morwenn going to a celtic rock live show tonigjt!
Let's see what's good
 
Ven
5:48 PM
The O'Dinkys.
 
@Puppy Isn't re-entrancy a thread-safety-related property of a function? Or something related to locks?
 
6:02 PM
related, but not the same. Non-threaded code can call functions re-entrantly.
And yeah, locks can be re-entrant (e.g. recursive_mutex) but that's the other way around
 
Ven
No you
 
But nobody was supposed to use recursive mutexes. For the original
intended purpose, only the global mutex would work anyway. And if you
could analyze the code paths enough to know that a separate mutex was
safe, why the heck would anyone want the overhead and complication of a
recursive mutex instead of just doing it right? I still didn't delete
it, but I more or less stopped thinking about it for many years.
 
Ven
Don't use mutex if you can, period :P.
I've used a recursive_mutex, because CBA refactoring everything else
 
Don't use lock if you can, period
 
6:14 PM
I don't like seeing typedef struct ... in C programs.
 
I don't like seeing C programs
 
don't
 
I do
 
6:15 PM
I actually love seeing struct foo x; instead of foo x; for some reason.
 
Ven
@fredoverflow That's because you're a pedantic madman.
 
@fredoverflow Oh right, I think I learned something today... I read a lot of bad C code. It always confused me when reading code defining structs like this: struct Something {} _something_super_complex;
I always wondered why people name their struct twice
 
struct s {} t; defines a struct s and an object of that struct named t.
typedef struct s {} t; defines a struct s and a typedef for that struct named t.
 
that's what I read... didn't know we could inline the struct definition with an object declaration
 
Ven
And typedef struct s {} t o;... :d
 
6:28 PM
@Ven t o is a syntax error
@LoïcFaure-Lacroix You can also have anonymous structs:
struct { int x, y; } p = {2, 3};
 
Ven
@fredoverflow I know, I'm just joking.
I should only have a single C project left for school. Then I'm freeeee
 
free(Ven); // and she's gone :(
 
@Ven Freedom is an illusion
 
Ven
Why she doe
.oO( is our soul only a pointer )
 
@fredoverflow grue
 
6:33 PM
From the YouTube comments on the pointers video:
> C++ is C :) . With a few addons indeed. But mainly its the classes.
 
youtube the humanity last frontier
 
> PLEASE make a video on S.O.L.I.D. principles of OOP. ITS IMPORTANT STUFF!
 
Ven
He means I.M.P.O.R.T.A.N.T.
 
still miffed you can't do this:
struct { int a; int b; } function() { return {1,2}; }
 
@zounds reminds me of this K&R C failure c-faq.com/struct/retcrash.html
 
6:38 PM
> error: new types may not be defined in a return type
@zounds :(
 
@milleniumbug wow I didn't know that was legal in K&R. moving backwards >:(
 
Ven
@milleniumbug holy cow that's horrifying
 
> Since structure-valued functions are usually implemented by adding a hidden return pointer
TIL
 
Ven
The Great Hacks of Our (Parents') Time
 
6:56 PM
i mean i assume it'd have to be implemented that way, no?
 
@BartekBanachewicz A haskell question if you dont mind
 
Ven
@Horttanainen ask away
As usual
 
7:32 PM
This test: https://github.com/horttanainen/tictactoe/blob/master/test/CoreSpec.hs#L40
gives me this error:

test/CoreSpec.hs:40:
1) Core.parseB parses a board from given string
expected: [O,O,X]
but got: [O,O,X]
@Ven Sorry my cat wanted me to take him out
 
@Borgleader:
https://meta.stackoverflow.com/questions/355215/unreasonable-suspension/
https://meta.stackoverflow.com/questions/355310/chat-banned-from-the-chat
 
Ven
7:48 PM
@Mysticial great ones
@Horttanainen the expected/got are the same?
 
@Ven yes
That is the thing that is baffling me
 
Ven
Sounds like a mistake in Show then
 
@Ven okay. Ill look into it now
thanks
 
Why do indians glue everything in their video usually with glue sticks...
 
Ven
@Horttanainen ah, I got it. It's because you discard position info in your Show
But your twoNoughsOneCross's 3rd element, the head of rowOfCross, has a position of 0
 
7:55 PM
YES
that is it!
thank you very much
 
Ven
Np :)
I don't really see the point of storing the position in Cell
 
I am not sure either
I am going to make transposes and match diagonals so I thought that could be useful.
 
Ven
I think functions that work on [[a]] ought to be enough
 
8:10 PM
You are probably right. I am also going to do machine learning with this. Maybe the positions could be of use then? I will certainly drop them If I don't find an use soon.
 
8:21 PM
@Ven Do you think this is good haskell or too dense? github.com/horttanainen/tictactoe/blob/master/src/Core.hs#L77
 
nwp
8:33 PM
Debian testing has clang-5.0 now.
I can try to mess with all the things now.
Except it also refuses to compile with -std=c++17 -.-
 
@Horttanainen it's OK
altough could prolly use a where helper or two
 
8:49 PM
@BartekBanachewicz Ill try how it changes the readability
thanks
 
nwp
std::array a = {1, 2, 3};
glorious deduction guides
 
 
1 hour later…
9:57 PM
And what language might that be... — sehe 17 secs ago
dayum. That post is rife with bad answers
 
10:13 PM
The question was answered here stackoverflow.com/questions/45722805/…sehe 17 secs ago
Anyone around with the Mjolnir hammer? I used my closevote before I noticed the older question.
 
10:38 PM
Thread. What a thread! https://twitter.com/YourRacingBelle/status/897620452843167744
 
nwp
10:52 PM
Apparently they broke warning disabling in clang 5. -Wno-unused-function no longer stops it from producing warning: unused function 'debug_print' [-Wunused-function].
 
11:15 PM
maybe you need to pass it at link time too
 
nwp
11:29 PM
It complains at compile time and adding it to the linker flags has no effect.
 
#pragma clang diagnostic ignored " -Wno-unused-function"
 
nwp
11:46 PM
#pragma clang diagnostic ignored "-Wunused-function" works, thanks
 

« first day (2498 days earlier)      last day (2436 days later) »