So the last thing it's trying to create has a dependency on some interface. According to the error message, you haven't told Auryn how to create that interface.
That's the thing though, it should never be seeing that interface as a thing that should be created. Gimme a sec to type this out.
This code uses Aura Session. Auryn has a delegate registered for Session that invokes a SessionFactory. Session is marked as shared. SessionFactory invokes a CsrfTokenFactory with a newly created Randval, which implements RandvalInterface. Auryn is complaining about RandvalInterface, but it's never being asked to resolve it, because the CsrfTokenFactory creates a concrete instance of something that implements it...
I'm trying to figure out why and where and how Auryn is getting the idea that it needs to pass a RandvalInterface.
@Fabor I would have been surprised if it wasn't. Machines don't white-screen like that unless it's a gfx fail, mobos/core components fail either with a stop error or with and instant safety reboot. What I saw was a gfx card failing and the mobo taking a second or two to realise. But yeh, live and learn I suppose, and you could always build another workhorse machine off the back of it, you've already got the most expensive bits.
Cheapo case, medium-grade RAM, cheapo HDD and you have another machine for distributed computing or just a torrent slave/seedbox or sth
Or firmware, but tbh I've not owned a high-end gfx card for so long that I'm not even sure if that makes sense any more, some of them basically seem to be self-contained computers, almost ASICs
It's f***ing annoying to have travis fail with SIGSEGV and not being able to reproduce any failure locally :x:x:x
@NikiC Could you please try to run the sapi/phpdbg tests with opcache active and tell me if it segfaults for you? [and ideally fix it^^] … I have nothing to repro it…
@Charles When I hit "wtf this can never happen" things, the solution is usually an 1-char typo. Either you mistyped a class name or (depressingly common) reflex-typed a $ where one doesn't belong, resulting in a var var/var prop you weren't expecting.
@Charles Or just an epic fail because I wasn't paying attention to what I was writing :-P
@Danack You know, one of things I was thinking to myself when this was being discussed in you talk was "surely that should be the default behaviour, there are almost no situations where having multiple injectors makes sense"
If you have more than one injector you're probably using it as a service locator
@DaveRandom That was answered in the questions, briefly. There are valid usages for having multiple teams working on the same code base, with one of those teams having to work in a more strict security context.
@FlorianMargaine This. In the general case (to which I'm sure there are edge-case exceptions), if the injector leaves the bootstrap then you are Doing It Wrong™
Also, there are differences between things that can be shared across all of an application, vs things that can only be a shared across a 'scope'. e.g. if you have a background task that processes stuff, some things (like database connections) can be shared for all of the task processing.
For things that depend on user data, they can't be shared across the whole application. They can only be shared across the scope that deals with that user data.
@Danack Note the "almost". I didn't/don't really get that, can't visualise it, don't understand why that requires more than one injector (at least, don't get why such problems couldn't be resolved at the application design layer rather than wiring) but I'm very confident in saying that most people don't have that problem in first place
@Danack This is my point. I understand the problem, I don't understand why solving it at the DI level is the right way to do it (or even an easier/quicker way to do it, which is the usual reason for experienced people doing things badly)
huh, github makes you log in for private gists, irrelevant but seems a little strange
@Danack I got to sentences in and: this. There's just no reason, esp. in the context of the process isolation of PHP, where this should be an issue. If you think it's an issues it's because your design is bad.
The flip side i.e. real-world caveat to this is that everyone has legacy code where you need to solve these problems
But that still doesn't detract from my original point, which is that the inject should be shared by default. Defaulting to the case where you are doing things badly is not the right way even if it is the most common situation /cc @rdlowrey
It's a very mild incarnation of it, but in a small way it is perpetuating the problem, and it also causes issues like @Charles just had - in a sense you a slightly punishing people who are writing new, good code by making them add that line.
@DaveRandom "If you think it's an issues it's because your design is bad." No....There are cases where I need to share an object/data that is shareable for a context, but isn't shareable universably.
And yes, I realise it's technically global state, but the injector is essentially stateless in the context of an application - it has state, but the state is set and bootstrap and doesn't (shouldn't) change throughout execution
@Danack In the context of the web, I don't buy that. The water becomes a lot muddier in the context of things with long-lived running space, but the web is "get it out the door asap and die" and these problems can be solved better with context-specific implementations
@bwoebi Because the probability of me making an arse of myself is massively higher. The fact that I've done it in person, with the person I'm conversing with, is not relevant. I still fear his beard.
Even in the context of webservers, being able to setup an injector that doesn't know how to create any objects that are 'dangerous' to use, can be useful for large projects where some people one the team might be 'special'.
In many ways I admire @Danack's beard all the more, simply for the fact that it's more socially contentious (in general). Hipsters have pony tails, UNIX programmers have insane unkempt beardage
@Danack Yes, but my point is that the "special" people are the ones who should have the extra cognitive overhead of remembering to disable sharing of the injector.
Imagine you had never heard of a DIC before and you are playing with it for the first time. What would you expect?
IMO, you would expect it to be shared, something that is designed to wire your application up would work the same everywhere.
Again, very much YMMV
user895378
@DaveRandom I don't necessarily agree that it should be shared automatically.
Meh - it'd be annoying to program if nothing else. As soon as one thing needs to be 'unshared', it would enable a whole chain reaction of bug related to being able to unshare other things.
@rdlowrey I don't feel strongly enough that I'd go out of my way to fight for it, just saying that's what I would do if I wrote it. I suppose to sum up my thoughts in a sentence: The most common case is not necessarily the default, the most logical case is.
@bwoebi For very specific use cases where you need to create a lot of related things in one place (usually siblings, always some kind of VO) I don't see the harm in grouping said factory functions into a class so that the consumer has a single dependency.