« first day (1624 days earlier)      last day (3307 days later) » 

7:00 PM
when I first saw "transfiguration" I was like what
 
@BartekBanachewicz Fun fact: that's in the real version too
 
4 messages moved to bin
 
my life's been a lie
 
7:00 PM
I found this cool site called Google
 
ITT money has transmogrification powers - can turn Koalas into developers.
 
@LightnessRacesinOrbit so I was right!
 
@BartekBanachewicz technically ;p
don't get used to it, sunshine
 
nanana ~
 
ok shop time
WISH ME LUCK
 
7:02 PM
@MartinJames I haven't been paid yet. I was promised $50/nanosecond.
 
@JohanLarsson Mocking in what sense? Making fun of them?
 
@LightnessRacesinOrbit Mebbe there will be opening offers?
 
could be
it's been open since Thurs
I'd wanted to be the first customer but I've had a permanent hangover since about then
 
@LightnessRacesinOrbit Strange - not had a drink since Thursday. Will get fixed later.
 
user1804599
7:04 PM
> (^100).roll(10)
71 94 39 47 36 22 61 87 4 28
 
user1804599
cooooool
 
@orlp ahahahahhaa
oh my god
there have been a lot of fun things in the last 15 minutes
but this is hilarious
 
@FredOverflow Pass in test doubles. I don't share your hate for singletons. I write things that are singleton like singletons. Settings, logs, plc etc.
 
@JohanLarsson settings aren't singleton uh
 
Just cause it has .Instance does not mean I have to dumb it an .Instance it all over the place.
 
7:05 PM
@JohanLarsson How? If X is a singleton, and you need a replacement at some place where an X is required, how do you pass anything else but an X?
 
@BartekBanachewicz Global mutable state, no design will make it not so.
 
@JohanLarsson fuck your code hth
there are no excuses for global state besides ignorancy, laziness and stupidity
 
@BartekBanachewicz Not without adequate protection.
 
global state always, regardless of use, turns into an unmaintainable mess
 
@FredOverflow I still inject them via ctor and have an interface for them. Nothing advanced at all going on.
 
7:07 PM
you inject what
a type?
 
Why have the global at all then?
 
Then wire up the IoC like kernel.Bind<ISingleton>.ToMethod(_ => Singleton.Instance)
 
using IOC and Singleton in one sentence
what the hell
 
7:08 PM
@LucDanton how do you mean?
 
it was a fun chat just a while ago
 
@BartekBanachewicz What is wrong with it?
 
let's start with "everything" and go from there
 
You’re willing to deal with passing the things around, just not too much?
 
@JohanLarsson Settings are not singletons. You can have multple setting instances. For example, current settings, and soon-to-be set by configuration window.
 
7:08 PM
Singletons are ok in the Haskell sense
immutable value associated with a particular type
 
But what about String pools?
 
@milleniumbug Sure. I have machine wide settings, can't just close my eyes and wish that they go away.
 
there's nothing wrong with global constants
Pi is a global constant
 
@JohanLarsson So they only fit one of the singleton criteria (as in, they're global, but not only one instance)
 
but global state is just bad. It's been a well-known fact in the last century already
heck, it doesn't even touch "global" per se
it's about "state available to too many components for write"
 
7:11 PM
@milleniumbug If they are changed in the edit view the user expects the settings to have effect.
 
not until you click Apply
 
Just for the record I agree that doing .Instance all over the place is dumb. Passing them in via ctor and doing .Instance when binding them in the IoC works fince ime.
 
@JohanLarsson Consider this
 
4 mins ago, by Luc Danton
You’re willing to deal with passing the things around, just not too much?
 
@BartekBanachewicz depends on how the user wants it. Writing directly to the setting and saving in background is my preferred way. Easier code & easier ux.
 
7:13 PM
@BartekBanachewicz I have many apps where the config change is attempted on every keypress.
 
@JohanLarsson k what if you want switchable settings profiles
 
@JohanLarsson a.) user selects configuration window -> configuration window copies the settings instance b.) users selects new settings -> the local instance is modified. c.) user clicks "Apply" - the global instance is replaced by the local one.
 
@LucDanton I still don't understand :) I want to protect myself from multiple instances of what should be one. Have spent many hours tracking down those bugs.
 
IOW there is more than one instance
 
Okay then.
 
7:15 PM
If I want more than one setting profile, I use more than one settings folder and have to restart my apps.
 
@JohanLarsson What is the amount of .Instance that is right before it’s dumb?
 
@milleniumbug I edit a copy and update the singleton on save but just a variation. Save cancel adds some complexity as navigate from etc must be tracked & handled.
@LucDanton One call per type when wiring up the IoC
Doing .Instance makes it untestable of course.
 
I still can't stop laughing at "IoC via Singletons" pattern
 
@JohanLarsson I don't quite follow. So you don't prevent copies?
 
@BartekBanachewicz It is pretty standard, name a container that does not have .InSingletonScope?
 
7:20 PM
I am not really into this OOP gimmick
 
@milleniumbug Yeah, just extra safety. Spent much time debugging those as I said.
 
Btw, I updated Coliru's default build command to use -std=c++14.
 
user1804599
Alright.
 
but regardless of paradigm, mutable global state is never appropriate
 
I'm not a singleton fanboi btw.
 
user1804599
7:21 PM
> my $i = 0;
0
> gather while $i < 5 { take ++$i }
1 2 3 4 5
 
user1804599
Just like C# generators!
 
it breaks like every principle of software design
 
@JohanLarsson I know you are. You probably have posters of singletons in your room.
 
mutable global state is something that can offend programmers of every culture, language and paradigm
 
@BartekBanachewicz I agree it is not much fun. But sometimes a problem that must be dealt with.
 
7:22 PM
you're already passing that data, so instantiate it properly.
 
It is not data, it is state.
No need for data to be singleton.
 
@JohanLarsson and the difference is
 
State is mutable, data is data
 
oh for you "state" means reference
 
At least how I think about the words.
 
7:24 PM
yeah well w/e you're already passing the state
 
I think I haven't used singletons in 2-3 years now. And I indeed feel better about myself now. However, looking back, singletons were rarely a cause of harm in the codebase.
Their harm was in not realizing there's a better way I suppose.
 
In my codebase at work I spent hours trying to work around retarded singleton design
because no one cared enough to structure the code, it was largely unstructured
 
to be expected from your codebase :P
 
which meant anything that relied or needed some structure collapsed
@StackedCrooked well "our"
I wasn't the one who wrote that crap.
 
@Bartek Say you have a program with a language setting. Is that setting global mutable state? I say it is.
 
7:27 PM
> "Exceptional C++ Style: 40..." has shipped
Yay.
 
@JohanLarsson ironically, what I was adding to our game was a language setting
and I failed spectacularly
I've spent days on what should take 2 hours
because the initialization order of anything was largely undeterminable
 
bind it in the IoC and be done with it.
 
again, no hierarchy present, no structure, just a big hairy mess
@JohanLarsson at that point I can get rid of global state altogether because I won't be needing it
 
it is still global mutable state
 
I spent almost an entire week trying to fix a mysterious bug which was probably the result of a race condition.
 
7:30 PM
@JohanLarsson it's really not. It concerns components that deal with the language
if something doesn't deal with the language it doesn't need it
 
I didn't find it. I fixed the code by reverting to singlethreaded processing.
 
the network component doesn't need that setting
logger doesn't need that setting
 
A colleague spent two days assisting me in trying to find the bug.
 
@BartekBanachewicz sure but in an ui app the language setting tends to be used in couple of places ime.
 
@JohanLarsson so make it a member of respective places' components
 
7:32 PM
I resolve it via ctor where it is needed.
 
yes, do it via a constructor.
 
of course
 
then you can stop it from being a singleton
from the components' point of view it's not a singleton
 
Is this the fifth time I say that doing .Instance all over the place would be dumb?
@BartekBanachewicz that is true.
But does not really change the fact that it is global mutable state
 
@JohanLarsson is there one language setting per app?
 
7:34 PM
lol, the singleton/mutable global/whatever is more fun than LRiO vs. Harvey
 
then make it a member of App class
I'd accept a global variable if you guaranteed me that on the whole planet only one program ever will have only one
 
@MartinJames I think this is the first time I really discussed code here. Think I've been 100% lame jokes & dumb questions up to now :)
 
@JohanLarsson That's absolutely fine:)
 
@BartekBanachewicz sounds extremely smelly.
 
why? It's an App. If you instantiate an App, you instantiate a language setting for it
that way things that don't belong to one App instance aren't affected by that
 
7:36 PM
I bind it in composition root and have the container pass it to the classes who needs it via ctor
 
yeah so it's only a question of how it's instantiated
 
put it behind an interface if it needs to be mocked
 
and my point is that there's no reason to instantiate it as a singleton
 
@BartekBanachewicz yes, preventing having to track down multi instance bugs.
 
how the hell do you ever stumble on multi-instance bug is really unclear for me
you instantiate it exactly once
 
7:40 PM
there are ways. Say I bind the interface and someone resolves the class in the ctor. Then the container will pass multiple instances. Has tracked those bugs down a couple of times.
an other way is if someone dumbs it and does new instead of resolving via the container
 
@StackedCrooked Good decision :)
 
@JohanLarsson well then if someone creates a new object
that's what they want, no?
 
user1804599
Alright.
 
not for the language setting no.
 
so you're deciding it upfront for everyone that might ever use that class
"you're never going to be in that scenario"
 
7:42 PM
Yes, it is global mutable state. Must be.
 
no it's not.
you're just trying to justify your laziness to do things properly
 
user1804599
> let primes = filter(0..Inf, prime?)
 
user1804599
Alright.
 
@BartekBanachewicz nah
 
you do it because it's easier for you and you know what, yes, having unstructured code is easier
certainly easier to write
not so to modify or understand later.
globals present outright lack of structure
 
7:44 PM
wtf man do I have to write a sample.
 
you keep thinking "but there can ever be just one language setting" and that's where you're wrong
you're not in the point to assess that.
 
not sure how to respond
 
@JohanLarsson besides, most of those components only need read-only access to language setting
so you don't even have to expose the constructor to them
 
yes that is true, trivially solved by a readonly interface
 
@райтфолд why is data first?
 
7:47 PM
@BartekBanachewicz do you speak C#?
 
user1804599
@BenjaminGruenbaum because the function is typically longer, and therefore putting it last is easier to read.
 
I'm not a C# pro or anything
but I suppose you can beat this language into submission if you need to
at least to the port of sanity
 
I'll write a small sample so you can flame hold on
 
user1804599
x |> f(g) therefore also desugars to f(x, g) except with different order of evaluation.
 
7:49 PM
@райтфолд but if you put it last then you get all sorts of goodies like currying easy. You typically want to compose these and data last makes this easier. Full disclosure - I was a data first fan for a while but changed my mind so I see your point about nicer syntax for chaining style, but if you have |> notation for chaining anyway might as well make the most of it.
@BartekBanachewicz what are you guys arguing?
 
user1804599
If you want to partially apply filter you can say %filter(%1, prime?).
 
user1804599
I find myself using |> and direct passing more often than currying.
 
user1804599
At least in Elixir.
 
i'm back
that was genuinely exciting
 
Ok, although if data was last and functions autocurried then you wouldn't need the %1 and % every single time.
 
7:50 PM
@orlp LOL
 
@BenjaminGruenbaum I'm saying that global mutable state has no use case, and Johan is trying to convince me mixing Singletons with IoC is a good idea
 
No he's not, @JohanLarsson would never say that iirc he's a good programmer.
 
44 mins ago, by Johan Larsson
Then wire up the IoC like kernel.Bind<ISingleton>.ToMethod(_ => Singleton.Instance)
 
No one likes singletons, and mixing them with IoC is an even worse idea... it's why people hate singletons in the first place. Plus if you have IoC it's even more redundant and silly.
 
I'm not the one you're supposed to convince here.
 
7:52 PM
Why the heck would anyone use a singleton with IoC? Aren't we like 7 years past misko.hevery.com/2008/08/17/singletons-are-pathological-liars or something?
Maybe he's joking?
 
scroll up and assess that yourself, I'm bad at detecting that
 
Wait what? Did he really answer then close it? stackoverflow.com/q/29320350/1348195
 
user1804599
@BenjaminGruenbaum I love singletons.
 
user1804599
I couldn't live without Unit and Nil.
 
Not the same kind of singletons :D
 
Xeo
@BenjaminGruenbaum The fuck "opinion based"
Andy asked for authorative sources.
 
@BenjaminGruenbaum I'm not :)
 
@JohanLarsson still not sure..
 
what happened to lightness vs. robert harvey?
comments apparently gone :C
 

« first day (1624 days earlier)      last day (3307 days later) »