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

12:04 AM
@NikiC @bwoebi So, I implemented Closure::compose() and got it mostly working, though it will need a bit more testing and the arginfo handling is definitely broken. But one particular thing is confusing me. If I try to do (function (&$x) { return $x; })->compose(function &(&$x) { return $x; })($a), I'll get an assertion failure because the function is returning a reference w/o ZEND_ACC_RETURN_REFERENCE.
@NikiC @bwoebi Now, that seems simple enough to fix: set ZEND_ACC_RETURN_REFERENCE on the function created if the f argument to compose (compose(f, g) => f(g(x))) has that set. But… it doesn't, and that has me confused. Either I'm checking its flags wrong, or userland functions don't always have this flag if they return reference. But it looks in zend_compile.c like they do. Any ideas? Is it hidden somewhere else?
(also yeah I'm sure my code isn't the most optimal way to implement this, but it does work at least)
 
 
1 hour later…
1:26 AM
@Wes just lost internet, tethering off of LTE right now, and power is about to go out at anytime. I can see flashes of blue from the shorting power lines and power keeps going in and out.
 
@Andrea you sure the flag is not set on the original function?
I'd think it more likely that you just don't end up returning a reference for some reason
 
2:27 AM
@crypticツ you in FL?
 
2:45 AM
how this loop works please explain:
for($i=0;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo "*&nbsp;";
}
echo "<br>";
}
output:
*
* *
* * *
* * * *
* * * * *
 
Wes
3:36 AM
i hope you have enough internet to load the gif
the gif(s)
 
Wes
4:00 AM
morning btw
 
4:16 AM
o/
Currectly I have Options -Indexes command in .htaccess file. Now I want to use NginX instead of Apache. Does anybody know where should I write that command into NginX ?
 
@Wes you're killing my data plan!! =oO
 
Wes
:D
hope you are ok :P
 
Luckily I still have power for now. It peaks at 2am EST as the eye passes by. I'm doing ok, just riding it out.
 
Wes
4:32 AM
i heard it has lost some strength
it still looks pretty bad though
 
over 3 million without power
up to 9 million expected according to the utility company
 
good morning
 
5:07 AM
morning
 
o/ yo Joe
 
posted on September 11, 2017

New Cyanide and Happiness Comic

 
I'm going to do a shift in a kitchen this morning, for the first time in 15 or so years ... should be fun
I'll tell you all how it went +5 hours, assuming I don't burn the kitchen down ...
lata :)
 
Wes
5:26 AM
that's the rule number 1, don't burn the kitchen down :B gl
5 hours of cooking??? are you cooking for an army? :B
 
a hotel
 
PHP's PCRE API doesn't differentiate empty matches from non-matches – #75181
 
my wife is manager, head chef has norovirus-like symptoms, can't come in for 48 hours and the second chef was fired a week ago for nearly failing inspections ...
 
I cannot connect to the server through SSH. Any idea?!
Noted that I've both restarted and shut-down/on it via my access panel
 
got a firewall ?
 
5:32 AM
Nope .. I've just add some lines to /etc/ssh/ssh_config file
 
probably the connection is being blocked at the firewall, all you need for ssh is a tcp connection to a service, if the service is running and you can't make the tcp connection, then there must be something in the way (a firewall) ... check both ends ...
 
ServerAliveInterval 300
ServerAliveCountMax 2
ClientAliveInterval 300
ClientAliveCountMax 2
 
don't fuck about with the config, you don't know what you are doing ...
anyway, I really am out, latas
 
ok :(
 
Wes
gl :D lata
 
5:49 AM
good morning everyone
 
6:08 AM
o/
 
Wes
6:19 AM
\o
 
enjoying the monday?
 
morning 0/
 
@JoeWatkins Ok, I connected to my server using VNC and I fixed the problem ..! Yay .. I feel profesional :-)
 
6:40 AM
@daverandom what's the state of your TLS shutdown improvement for PHP 7.2?
 
Wes
@Saitama do you like may kah? tu tu tu tu tu tu tu tu tu tu gas gas gas
i've watched some clips of this thing. i am not a car fan enough to bear it :B but i admire the fact that they managed to make a series on something that is potentially boring as hell - unless real
i mean an anime about car racing is hella strange, unless it's wacky races, or something like that
 
6:59 AM
 
o/
@tereško Is it possible to use MOSH instead of SSH for that tunneling? (Accessing Server's Databases)
 
Wes
spent way too much time trying to figure out what was wrong with this
return new class(Closure $get, Closure $is){
 
0.5ms... Wow, that's going to save, oh wait, just 0.0005 seconds of my life. I guess your brain won't notice the difference. — User that is not a user 6 hours ago
wut
Anyone know how I can set a stream_set_timeout on a non-blocking socket stream?
 
7:22 AM
morning o/
 
7:34 AM
I'm trying:
socket_set_option($server, SOL_SOCKET, SO_RCVTIMEO, array('sec'=> 1, 'usec'=> 1));
and I get:
Attempted to call function "socket_set_option" from namespace "Blah\Blah"
 
@bwoebi Ruby, Crystal, Elixir, CoffeeScript. Having another look, though, it's a shame we cannot extend the ${} syntax, given that it is already used by a lot of other languages (Dart, Groovy, Haxe, JavaScript, Kotlin, Scala, TypeScript)...
 
@Jimbo uhhh, what's the point? it's setting the timeout for read options
 
@bwoebi Thinking more about the {} syntax, I wonder if the potential BC break may be too large.
 
@tpunt you have a BC break either way… also, it's something a simple analyzer should be easily able to detect and even fix for you
 
@bwoebi True. I'll do some digging to see if there are many breakages with either syntax.
 
7:41 AM
The bigger problem here is that you cannot use literal (#){ } in a backwards compatible way "Foo \#{bar}" will give you a literal backslash
(well, obviously apart from writing "Foo #{"."bar}"
 
@bwoebi Trying to do it on with stream_socket_server.
Ah it's okay I solved it with some usleeps() ;)
 
sceptical look … usleeps in non-blocking code?
 
@Jimbo You're doing it wrong.
 
7:57 AM
Actually, I didn't solve it with usleep :D
Yep. I want the server to wait for a maximum of X seconds, regardless of what's happening, then close and throw an exception
$server = stream_socket_server(sprintf('%s://%s:%d', $this->protocol, $this->host, $this->port), $err, $msg);
    for (;;) {
            $client = @stream_socket_accept($server);

            if ($client) {
                $url = stream_get_contents($client);

                fclose($client);
                fclose($server);

                return $url;
            }
        }
 
@Jimbo stream_socket_accept is blocking, no?
 
Ah I figured it
stream_socket_accept accepts a timeout
 
@Jimbo Yes, set that to 0.
@Jimbo What you're doing is extremely hacky and not secure, but I guess you know that. :P
And depending on race conditions it won't even work that way, because browsers usually open multiple connections, even if there's just one request.
 
8:16 AM
@Jimbo you either use timeouts or non-blocking, not both
it you want to use stream_socket_timeout(), set the stream to blocking mode
 
Anonymous
morning
 
if you want to use non-blocking mode, use an event loop timeout (yield new Pause or Loop::delay())
and remember that event loops do not actually require non-blocking sockets
you can still poll a blocking socket, the blocking mode only affects I/O operations
 
@DaveRandom At that point you can just use usleep.
 
@kelunik well no, I mean if you are using TCP and the protocol in use has very small data blocks then blocking/non-blocking makes no difference
 
yeah, the whole point of non-blocking sockets is being able to use epoll()
(or similar)
 
8:22 AM
you can poll a blocking socket.
 
The point of non-blocking is do determine whether read/write calls will block
 
that's the point of poll(), no?
 
the point of poll is to determine when to call read/write
 
ok, fair
 
8:25 AM
gist.github.com/kelunik/36601941bdb53e74f2227cdc637edb5b < @Jimbo That's nearly the full code you want.
 
@DaveRandom well, not determine but actually being able to send a larger string onto the socket (i.e. larger than one byte. readability/writability only determines whether at least one byte can be read/written) or read a larger chunk at once, without blocking.
 
sure
and I mean obviously if you are using poll/select etc then you want non-blocking I/O, I'm not suggesting that you should not bother with it
 
@DaveRandom not necessarily.
 
@Jimbo Just updated the gist to include a timeout of 30 seconds.
 
for quick modelling, ignoring non-blocking does simplify code, it would hurt performance in a high-traffic env but for a low traffic app it likely makes little/no practical difference
 
8:31 AM
@DaveRandom uh, even with two clients blocking reads make a big difference…
 
@DaveRandom But there's just no working HTTP server in PHP which uses blocking I/O and can be used as a library.
 
@NikiC not the version inside the closure, no. that or my view of fFunc->fn_flags is incorrect somehow
 
@DaveRandom it's just that you typically can rely in friendly environments that once a stream is readable, full data will arrive very soon.
 
@kelunik comment out stream_set_blocking() in aerys and bench it. I would expect (I could be wrong but I don't think I am) that you will see very little, if any, difference at low-medium loads for small responses
Where it will make a difference is with large payloads
 
@DaveRandom And will open it to very easy DoS.
 
8:37 AM
sure
7 mins ago, by DaveRandom
and I mean obviously if you are using poll/select etc then you want non-blocking I/O, I'm not suggesting that you should not bother with it
there are reasons for it
but if you are just sketching something out quickly, non-blocking I/O makes your code more complex and is not strictly necessary
@bwoebi I write my code to assume sane-ish/friendly environments, you can't code around OS doing something dumb
 
@DaveRandom I know what @Jimbo is doing, using raw PHP sockets will definitely make his life way harder than just using the snippet and Aerys.
 
sure
 
@DaveRandom It's meant clients doing evil stuff, not the OS.
@DaveRandom If you're using Amp, it doesn't make any difference, except that you have to know Amp and understand yield.
 
once a stream is readable, fread() can be called and it will not block
it might only give you one byte, but it definitely will not block
ugh this is such a pointless debate :-P
To be clear @Jimbo: just use Amp :-P
 
:grin:
 
8:45 AM
@DaveRandom haha
 
PHP is a dead language, it's official. There hasn't been a new framework in over 2 months
3
 
user986408
How do you guys manage "service discovery" for different environments? Currently my micro-services communicate via hard-coded URLs (localhost:8080, localhost:8081 etc.) but I want to make it more sophisticated, especially when deploying they need to communicate via DNS names...
 
@WillParky93 dude, you're just not paying attention
(h = humans)
@codepushr just use config files
that is the sort of thing that probably shouldn't ever change for a given deployment env, it certainly shouldn't change frequently enough for config files to cause problems
You could create some kind of service discovery layer but I will bet it's not worth the effort
 
@DaveRandom That "Laravel" thing sounds amazing, I should definitely go use that for all new projects!
 
8:59 AM
Get with the times, I code all my pages with wordpress
 
pfft, Wordpress didn't even make it in to the 11 Best PHP Frameworks for Modern Web Developers in 2017
 
user986408
@DaveRandom So basically create a config file for each service containing settings for each environment, and then use the host/port/dns config on startup based on args for example?
 
Obviously that website is a shill site
 
@salathe obviously you did not read the whole article. The graph at the end clearly shows that phalcon is the best.
 
Anonymous
> Symphony
 
9:01 AM
@DaveRandom ooh, my bad. Performance is top priority!
I'll be porting all the Laravel code I wrote in the last 4 minutes to Phalcon, ASAP.
 
@codepushr as a general rule, services don't need to know where they are themselves, if they do need to know that they can determine it from $_SERVER. What matters is that if service A needs to talk to service B, then service A needs to know where service B is, so service A's config file needs to contain the location of service B
service B probably doesn't need to know where it is, rather this is determined by the configuration of the enclosing web server
 
user986408
@DaveRandom make sense
 
6 mins ago, by DaveRandom
that is the sort of thing that probably shouldn't ever change for a given deployment env, it certainly shouldn't change frequently enough for config files to cause problems
this is the key point, this should be a "configure once and forget" thing
like if you are moving stuff around all the time you are doing something else wrong :-P
 
user986408
Which sort of implies that this config shoud be stored somewhere, where each service can read it... my micro-services are each in a separate git repository.
 
@Jimbo Did you try it?
 
9:07 AM
@kelunik Not just yet ;) The reason: it's an extremely simple script and I don't have AMP in the project...
 
user986408
how can codeigniter be on par with symfony, people are crazy...
 
@Jimbo How many days have you spent yet on that issue?
 
someone help, why isn't my php working. <?php<script> alert(hello world) </script>?> its suppose to print out "hello world" on my page but im getting whitepage
 
Anonymous
@WillParky93 please go away.
 
user986408
9:08 AM
:'D
 
@kelunik Just a few hours :D
 
Morns, lads
@JayIsTooCommon that's not very nice
 
9:25 AM
phpStorm, Code -> Completion -> Cyclic Expand Word; anybody knows what that is?
 
@AaronSmith press it, and find out?
 
it seems like I am not on that level yet :)
 
PHP is a dead language, it's official. There hasn't been a new framework in over 2 months
 
I have it for a second day now, and I am still learning the php
I searched on the net before asking here
 
9:30 AM
@Andrea It should be preserved in the closure as well, it's one of the flags we keep: github.com/php/php-src/blob/master/Zend/zend_closures.c#L353
 
@NikiC ooh, okay
 
Cyclic Expand Word = "Omni completion", that's what this is?
 
Should DateTimeImmutable/DateTime throw a exception – #75182
 
I've found an explanation on their site, thanks
Hippie Completion - expanding words based on context - this is
 
@bwoebi Oops, I forgot to update the string escaping function. Now, "a \#{b}" should show "a #{b}"
 
Wes
9:35 AM
the ignore link is so dangerously close to kick
 
@Jeeves errr... lol
 
@DaveRandom What's yours?
 
["date"]=>
string(31) "2017-03-15 00:00:03.-2147483648"
@Jeeves I'll have a pint of cheap foreign lager and a packet of salt and vinegar crisps, ta
 
@DaveRandom Would you like fries with that?
 
Wes
@DaveRandom member our discussion(s) about class friendship? i've had an idea. not sure if you are actually interested in the feature though
 
9:37 AM
@Jeeves No, I already asked for crisps
 
@DaveRandom What happened?
 
Wes
i hate writing clumsy code because of oop limitations :B
 
@Wes refresh me on what that actually means?
 
Wes
i remember you discussing it with andrea and we talked too about it, remember "namespace-protected" visibility for methods?
 
I do want that but I've not yet seen a sane suggestion for how to implement it I don't think (specifically how the visibility would be limited)
 
Wes
9:40 AM
that was a crap idea tho, i tried to write the specs and i realized it wasn't that great after all. but now i have a new idea :B it's super overkill... but i love how it makes sense
 
like really I just want the equivalent of internal in C# - package-public but externally private
and since PHP doesn't have packages...
 
Anonymous
dunno, @JoeWatkins is a bit of a package.
2
 
He's a lovely package
 
In fact I did like namespace Foo\Bar::Package\Ns
 
Wes
i have a better idea :B
do you have some time?
it's probably long to explain.
 
9:42 AM
Not immediately but probably around lunch
can you gist it?
 
Wes
yeah that sounds like a better idea... lemme write it
 
@Wes ping me too when you get it, i'm curious :P
 
I really want to use uopz now to replace is_uploaded_file and move_uploaded_file.
 
@DaveRandom inner classes
 
@FlorianMargaine ugh
back to the bad old days of 5000+ line files
 
Wes
9:56 AM
@pmmaga @DaveRandom i trust your understanding skills despite my poor explanation gist.github.com/Netmosfera/7ca842357024d78336c223f24eb639f2
 
@DaveRandom more seriously, have you ever looked at how Common Lisp does it?
 
Wes
added an example
 
A $GLOBAL variable is magically modified – #75184
When accessing with / at the end of uri with extension,source code is displayed – #75183
 
Wes
anyway, something like that
fixed mistakes sorry. check again :B
 
10:08 AM
@Jeeves People do really horrible things. :D
 
@kelunik I want to eat cheese and drink wine.
 
hello every one, i am facing problem in mail sand service and error :
Warning: mail(): Failed to connect to mailserver at "smtp.carolplayer.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in
 
Anonymous
@Jeeves fat bastard
 
@JayIsTooCommon Nothing right now. I ate a bunch of pizza.
 
Wes
@Jeeves are you from France?
 
10:10 AM
@Wes Maybe sleeping. i'm feeling bleh.
@Wes No, I am from Scandinavia.
 
Wes
@Jeeves are you a woolly mammoth?
 
@Wes That's not important.
 
@Wes humm... ok, i think i get it. do you have a practical example of why would you need it? it sounds like a twisted inversion of control where there shouldn't be one :P
 
Wes
my sole point is that without something like that you end up writing clumsy redundant code. sometimes you can't keep stuff encapsulated unless you make a mess
i like the anon class example because illustrates the problem. to solve that i need to create a third entity with weakened visibility and pass it on both the actual class and the anon class, wrappers around wrappers around wrappers... shouldn't be like that
maybe it's a problem just for me... i hate doing that
 
everyone survived
 
Anonymous
10:22 AM
did you cook or something?
 
@Wes i'll retry to wrap my head around it (pun intended :P)
 
Wes
refresh the page because i did some changes again :B
 
5 hours ago, by Joe Watkins
I'm going to do a shift in a kitchen this morning, for the first time in 15 or so years ... should be fun
 
Wes
@JoeWatkins gist.github.com/Netmosfera/7ca842357024d78336c223f24eb639f2 thoughts? alternative to "friend classes"
 
Anonymous
ahaha
 
Anonymous
10:23 AM
called it!
 
where did this idea come from, what problem are you trying to solve here ?
 
Wes
the idea i'm afraid comes from my mind :B
 
oh oh, you can't see me ...I'm just staring at the screen with a blank expression on my face, waiting for you to tell me what problem it solves ...
 
Wes
i hoped you would read just few messages above :B
 
oh I did not get that ...
 
Wes
10:29 AM
solves nothing, just makes stuff more comfortable to use
 
show me where to read from so I get the whole story ?
 
Wes
12 mins ago, by Wes
my sole point is that without something like that you end up writing clumsy redundant code. sometimes you can't keep stuff encapsulated unless you make a mess
 
Hey all, random question... do you guys know if files zipped with software such as Winzip can be emailed? I've tried compressing and sending a folder using Windows but its not getting past Googles filter. On a work machine so want to find out before downloading anything
 
class Foo{
  private function bar(){
    echo "it works!";
  }
  function getObj(){
    return new class(private $this){ // handed it with full access
      function __construct(private Foo $foo){ // because it's required to be private
        $this->foo = $foo;
      }
      function call(){
        return $this->foo->bar(); // can call it
      }
    }
  }
}
 
Anonymous
@Daruchini Zips are blocked / filtered by most email clients iirc
 
10:32 AM
why is visibility declared by caller and callee, I'm not sure I get that ?
 
damn, is their a work-around? I've tried making up an extension and that kinda works. Getting filtered to the spam box with a potential malicious file alert
 
@JoeWatkins Variable capturing and outer class access would be really cool.
 
Wes
function bar(protected Foo $bar){}
this must be read as param 1 must be a foo instance with protected members access
 
when I ask myself the question "how easy is it to model code in a world where this feature exists?", or "does this feature make it harder to model code in your head?", I have to answer that it's not so easy to model code that can change on the fly, and it does make it harder ...
 
Wes
class Foo{
  function test(){
    bar(protected $this); // give with explicit protected access
  }
}
 
10:34 AM
it would be, but the way I done it sucked, so I'm waiting for nikita/dmitry/bwoebi to do it ...
 
Wes
that's why it's both on caller and in signature
 
@Wes That'd be a really good idea for references.
 
Wes
basically the visibility is part of the type declaration
 
mornings v2 o/
 
got any idea how it would practically work @Wes ?
rather how it would be implemented ... what do you do at function entry to an object marked as private, and can you then pass that to another function as protected, and are they the same objects, or clones, or wrappers, or something I haven't thought of ...
 
10:37 AM
@JoeWatkins is that anywhere I can check?
 
the other way round ...
@pmmaga there's an open pr, but it's never been to vote, core devs want something better than I done ...
they want
 
Wes
class Foo{
    public function someMethod(): private Foo{
        public Foo $self = $this;
        private Foo $selfWithPrivates = private $self; // "casts" visibility
        return $fooWithPrivates;
    }
}
 
class {
    public $thing = $this->thing;
}
that sort of action
wait now we are declaring the type and encapsulation for local variables, it just got 100x more complicated
 
Wes
@JoeWatkins i have no idea how it would be implemented, but each variable reference would hold the visibility
 
and type apparently ?
we can't reasonably do that you know ...
 
Wes
10:40 AM
nope
 
private Foo $selfWithPrivates = private $self;
then what does this mean, why is there a type ?
 
Wes
if that visibility is private, the object associated with it will have all members enabled regardless of the calling scope
 
@JoeWatkins I've never really felt the need for that. Every use case is probably solved with Closure::fromCallable.
 
Wes
3v4l.org/Gpvsb @JoeWatkins
 
what is the difference between that and
function asPrivate() : private Foo {
    return $this;
}
?
 
10:44 AM
@JoeWatkins Which problem does that feature solve?
 
at function entry (params) and exit (return) I can just about see a way to do it, although I'm still not sure of the justification, but if you're talking about declaring the visibility of any variable (and type or not), that's much harder ..
no clue
I don't think I'd like to work with code that used this feature ... I might even enjoy hurting people who used this feature ... with a bat ...
 
Wes
difference is that you can statically analyze it :P it's like
class Foo{ function bar(){} }
function x(){ return new Foo(); }
x()->bar();
and
class Foo{ function bar(){} }
function x(): Foo{ return new Foo(); }
x()->bar();
both work, but the latter is nicer
 
@JoeWatkins For the really rare case where you need that feature for a hack, you can just use a closure and bind that to the object's scope.
 
@kelunik yeah ... it's @Wes's idea ...
 
@Wes Why do you want such horrible things?
 
10:48 AM
@Wes has no respect for other people's privates :B
 
Wes
so basically it's just
$var = private new MyClass();
$var->privateMethod(); // works
$var2 = $var;
$var2->privateMethod(); // doesn't work... different var ref
 
a lot of the ideas I have I keep to myself, because they might make me look crazy or disgusting ... like the other day I wondered what a sausage croissant would be like ... but I didn't tell anyone, I just stuffed a sausage into a croissant and tried it, and found out it was horrible all by myself ... without telling anyone ...
4
 
@JoeWatkins I could have probably tried that, too.
 
Wes
@kelunik i don't want it unless you want it too :B
 
@Wes I definitely don't want it. :P
 
Wes
10:49 AM
in my mind it's brilliant :B it's much better than friends classes for example. and that is a thing that exists
 
Anonymous
@JoeWatkins ever dipped a chicken nugget in milkshake? No? Do it
 
@JayIsTooCommon ugh
 
Anonymous
don't knock it until you try it..
 
@Wes herpes also exists ...
 
10:51 AM
@Wes Boo! The message exceeds the 140 character limit. :-(
 
Wes
BOOO
@JoeWatkins you guys should try to pioneer some better ideas sometimes, rather than copying java #shotsfired
 
Wes
i'm not sad. i never thought not even for a moment that you could like the idea :B
 
@Wes my first yo mama response was not suitable for little ears (@JayIsTooCommon) ...
 
Wes
ahahahahaha
 
10:55 AM
why does everything @Joe says gets starred, and not mine... ;-;
 
actually being like java is no bad thing, we can all hate on it, and I firmly believe we should, really hard ... but the fact of the matter is the thing is standing the test of time at least as well as PHP, there is a large overlap between the two, and if we can pinch bits of java that work, this is not a bad thing ...
I've tried new ideas, I can't remember how it worked now, but I came up with a new way of managing errors, I called them ripples, the theory was sound, but everyone just hated it for no reason ...
 
Anonymous
Aug 21 at 12:02, by JayIsTooCommon
@Saitama you're about as funny as aids
 
Aug 21 at 12:02, by DaveRandom
um... that's a bit much...
 
Wes
@JoeWatkins just like you guys trashed my idea almost immediately! :B it's not horrible. i think it works. it is completely overkill and for that reason shouldn't be in php... but it's not horrible :(
 
for me to be interested, it has to work in two ways, for users, and I need to be able to imagine a way to actually implement it, even if the implementation is bad ... I gave you the benefit of the doubt and skipped needing it to work for users but struggle still to find a way to actually implement it ...
if we can't reasonably do it, then even if it would make users lives 500% more glorious on average, we are wasting time talking about it whatever ...
 
Wes
11:12 AM
sure. and i agree with that. i can't help with the implementation as you know :B and as you said it's highly probable that is not worth doing it :B
 
@Wes I am curious - why do you find yourself needing to wrap code in other code so frequently, to begin with?
Other than caching, it seems a really rare pattern for me to use.
 
Wes
never needed the private data from an object accessible from another? in such a way that changes to one are seen by the other. you can do it with observers but that's like a million times worse than wrappers
 
11:28 AM
> in such a way that changes to one are seen by the other
Not updated constantly, no.
 
Wes
simple example, class A has an private int field, class B is a view to A (A is a dependency to B) you can either make the field public which is rarely an option, or have a third entity new A($c) new B($c) which contains the public field. or
function A::__construct(){ $this->c = new C(); }
function getB(){ return new B($this->c); }
all these options are super clumsy if you ask me
 
If I need to recalculate something, I would recalculate all of it's dependencies.......but by explicitly recalculating everything.
I don't migrate state across objects implicitly/automatically.
Can you give a concrete example (not A B C) of where you're finding a need to do that?
 
Wes
pretty much any case in which i have a private member that i want allow another class to read, but just that one class
 
11:51 AM
Scala has something similar but only works on package/namespace level -> alvinalexander.com/scala/…
 

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