« first day (3517 days earlier)      last day (1413 days later) » 
00:00 - 18:0018:00 - 00:00

12:03 AM
been battling with my file issues for a while finally got it to work except for one little issue is_uploaded_file() does not return true as the file was never uploaded but a base64 conversion which i managed to fake as a request
my question is is there a way to make my converted base64 file seem like a real file upload?
 
12:17 AM
@Danack i took your corrections and worked on my code and simplified my problem down to this point
i have improved my original question also stackoverflow.com/questions/62112346/… . but had to accept the initial answer as it helped me a lot.
 
hi guys
 
hello
 
i need some help
 
PDOStatement::getColumnMeta should fail predictably for an empty result set ・ PDO SQLite ・ #79664
 
> Don't ask to ask, just ask
 
12:24 AM
we all do :D
 
require_once('BrowserDetection.php');
$browser = new Wolfcast\BrowserDetection();
is there a mistake here?
 
It depends...
 
And probably need preceding \ for namespace I think
$browser = \Wolfcast\Detection();
 
i am trying to get it to work in my .php file but it keeps giving me: Uncaught Error: Class 'Wolfcast\BrowserDetection' not found in /var/www/
i will try that tiffany
 
12:27 AM
Errr, I didn't get all of it, but that should be a good enough example
I'm on my phone with a migraine ...
 
sorry @Tiffany guess the brain needs some rest
 
oh no! Uncaught Error: Call to undefined function Wolfcast\BrowserDetection()
 
are you certain that this require_once('BrowserDetection.php'); picks up the file
 
Paths can be tricky with require/include... I can almost never get it right the first time
 
well i don't see any errors in the log file
 
12:32 AM
Do you have error reporting set to E_ALL?
 
my php file and the detection php file is in the same directory
require_once('BrowserDetection.php');
so i guess this is correct
yes, E_ALL
ok i just moved the file to generate an error
 
Alright
 
it gave me PHP Warning: failed to open stream
 
And you added preceding \ for the namespace?
 
yes mam
require_once('BrowserDetection.php');
$browser = \Wolfcast\BrowserDetection();
 
12:35 AM
Oh
I know what the issue is
 
please enlighten me
 
Remove the () for the class declaration
 
require_once('BrowserDetection.php');
$browser = \Wolfcast\BrowserDetection;
 
... ....... Nevermind, this is why I don't code with a migraine
 
like so?
 
12:36 AM
I'm probably going to cause more trouble than be of help, sorry
 
ok no problem
 
@ircmaxell good day could you help me out with a way to make base64 converted files seem like a regular uploaded file
 
Don't ping random people
It's not cool
 
sorry am just so tried of this issue
i think i will just go figure things out alone
sorry for bothering you guys
 
 
3 hours later…
3:38 AM
lol
haha
 
 
2 hours later…
5:10 AM
Git mergin'.
 
 
1 hour later…
6:34 AM
wassup
is it possible to create mysql connections with php then query with js
 
7:03 AM
 
???
 
@OmerHijazi Check for AJAX concept if suits your needs in such request.
 
If JS is meant as JavaScript code on some browser page, then you have to use AJAX to send some kind of request (GET, POST, etc...) to PHP file on server and PHP would make job with DB and return result back to page. In short. But go and check AJAX how it works, first.
 
7:23 AM
ok thanks it worked
 
@Sayra Not really. Normally people will i) wrap the code that does a specific function call in a class ii) make an interface for that class iii) use a test version of that class in their tests to avoid doing the specific function call that can't be changed.
sorry, I don't really have a good example to hand and not sure how you would do that in Laravel. I suggest searching for "Laravel test doubles".
Also, mornings. Also, holy shit.
 
8:15 AM
@Danack ?
 
gestures at america
 
Still a dumpster fire
 
8:36 AM
@NikiC using array_map(fn($n) => $n * $n * $n, $a); results in Syntax error, unexpected ??? - does that imply my conversion is incorrect?
 
8:52 AM
Aren't there missing braces?
 
@Girgias no, PHP runs it just fine
 
Huh, well I don't know then
 
@Sjon Sounds like the token mapping from the lexer to the parser fails somehow
 
THe ??? is a decent hint, I suppose?
@NikiC We never concluded a date/time btw ;-)
 
cmb
9:18 AM
@Derick, did you do updates to bugsnet and/or the bug DB as well? All user notes are currently missing (bugs.php.net/79663)
 
rsync did get updated
not by me though
I'll ping Martin. What was the other thing that was broken? I saw something on systems@
looks like something with openssl configurations/versions though
i don't have access to rsync it seems
 
cmb
Thanks! I don't know what else is broken (besides edit.php.net).
 
rsync can't talk to master (to fetch the user notes), but I'm not sure on which side the problem is.
@Derick I can give you access if you want to poke around
Also, who do I have to bribe to join systems@ ? :)
 
10:01 AM
Can anyone help me with how to read timezone list returned from DateTimeZone::listAbbreviations();? I am getting three different data for timezone Asia/Kolkata, with three different offset? How do I select the correct one?
 
@SayantanDas what underlying problem do you want to fix? aka why do you care about the abbreviations?
 
@Danack I am generating list of timezones for users to select.
My code looks like what is provided in this answer stackoverflow.com/a/2839396/6662819
 
10:17 AM
dunno. Maybe hard code a list of the appropriate timezones? They don't change abbreviations that often.
 
@NikiC the number of nested attributes in doctrine is very small, the problem is really other users of doctrine annotations, specifically drupal. symfony has only a few nested ones around grouping validation with "All" constraints, symfony.com/doc/current/reference/constraints/All.html
honestly i think not having nested is not bad, because it constraints what you should do with attributes, and gives a signal to when maybe other configuration mechanisms should be preferred
as for doctrine nested attributes, they can all be flattened without problems
 
10:42 AM
@Danack I'll make a fork and prepare PR, regarding the karma system, that is interesting, but maybe I'll make first things first, got a KB system in my mind also
 
any one know how to explicitly get the laravel mysql read connection?
\DB::connection('mysql::read')->getConfig('host') seems to get the write connection
\config('database.connections.mysql.read.host') returns the correct host
 
@Petah \DB::connection(config('database.connections.mysql.read'))?
 
DB::connection expects the database connection name, not the host name, so that just throws an error
\DB::connection('mysql::write') returns the write connection as expected
 
morns
 
@mega6382 evening
 
10:54 AM
@salathe No thanks :-)
@SayantanDas Don't use abbreviations, use the identifiers only.
 
side question, anyone know how to make AWS RDS handle large spikes of connections, since PHP opens 1 connection per request, a quick burst of request hits the max_connections limit
 
ANd there are different abbreviations for Kolkata, because they've changed in the past:
Asia/Kolkata Tue Jun 27 18:06:32 1854 UT = Tue Jun 27 23:59:52 1854 HMT isdst=0 gmtoff=21200
Asia/Kolkata Fri Dec 31 18:06:39 1869 UT = Fri Dec 31 23:59:59 1869 HMT isdst=0 gmtoff=21200
Asia/Kolkata Fri Dec 31 18:06:40 1869 UT = Fri Dec 31 23:27:50 1869 MMT isdst=0 gmtoff=19270
Asia/Kolkata Sun Dec 31 18:38:49 1905 UT = Sun Dec 31 23:59:59 1905 MMT isdst=0 gmtoff=19270
Asia/Kolkata Sun Dec 31 18:38:50 1905 UT = Mon Jan 1 00:08:50 1906 IST isdst=0 gmtoff=19800
 
@Petah Maybe 'mysql::read' should be 'mysql.read'.
 
@Tpojka i get Undefined index: driver when i try that
 
@SayantanDas Also be aware, that timezone identifiers aren't meant to be shown to users...
 
11:01 AM
@Petah I haven't seen this notation before.
 
@Petah Nowhere on page you have '*::write' or similar.
 
yea, laravel docs suck some times
but that's the point, i have multiple db connections, and i want to explicitly use one of them
and the docs don't say how
 
@Petah Does having multiple top-level keys work for you (i.e. mysql1, mysql2, mysql_read, mysql_write...)?
 
yes
 
11:10 AM
I am out of options for read/write combined option (haven't used yet).
 
@Petah you could write your own code to create the connections, and just opt out of using Laravel's config system for this entirely.
When the config system isn't powerful for you, is an appropriate time to start moving away from tying everything to your framework imo.
 
but laravel splits read and write queries to the different connections automatically
 
What has that go to do with the price of fish?
 
as in if i do $model->save() is uses write, and Model::find() it uses read, i cannot do that with multiple individual connections
 
ah, vendor lock in....
 
11:15 AM
isn't that the way for any library that supports read replicas?
 
the way that Laravel ties everything together makes it super hard to change one piece. It's less of a problem for code that is designed to be more reusable.
 
im not really trying to change anything, just get the connection that it has reference to
i mean i could just new PDO('bla' . \config('database.connections.mysql.read.host')) just thought there would be a way to get the current connection
infact, is there a way to get the connection string from a Doctrine\DBAL\Driver\PDOConnection object?
 
@Derick :)
 
@Petah Something like $pdo = DB::connection()->getPdo();?
 
as in \DB::connection('mysql')->getReadPdo() returns a PDOConnection, but i want to know what the DSN of that connection is
 
11:27 AM
there probably shouldn't be. it could expose the connection password.
 
i didn't think the DSN contained the password
user name and password are typically in the other params
 
my bad, yep you're right.
 
Is this sufficient stackoverflow.com/questions/29160645/… (regardless use of separate file in this question)?
 
@Tpojka i dont think so, that doesn't seems to be using read/write replicas
 
Wes
@StatikStasis been trying to understand what's the suggested peek amplitude for youtube videos but it looks like there is no such guideline. no wonder volume is all over the place across different youtube videos, sometimes from the same channel
 
11:35 AM
well i seem to have got somewhere at least, calling SELECT @@hostname AS hostName at least returns me the internal host name
 
11:52 AM
@Petah And why do you need this exactly when correct connection is used regarding action in query/model?
 
i am trying to test the max connections of my aws rds mysql setup, with is single write, multiple read only replica, and rds proxy
but it seems its only hitting the write/proxy
orange being the master node, blue is the read replica
 
12:21 PM
ini_get() and opcache_get_configuration() may be inconsistent ・ opcache ・ #79665
 
Wes
@PeeHaa do you know of any software that can read the average and peak volume of a video file?
 
Do you want to normalize audio of a video file?
 
@Wes audacity can
 
@Petah what's \DB::connection('mysql')?
 
@Ocramius as in what does it return? an instance of Illuminate\Database\MySqlConnection
 
12:34 PM
Yeah, I'm wondering about how it is connecting. If it's DBAL under the hood, need to check if it's using a github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/…
 
404?
its just standard laravel
 
@Wes programmatically?
 
Wes
no @DaveRandom
 
it can be done with an ffmpeg command which would probably stretch round the equator twice
 
```
ffmpeg -i file_example_AVI_480_750kB.avi -af "volumedetect" -vn -sn -dn -f null /dev/null
[Parsed_volumedetect_0 @ 0x7f7f1ab04080] n_samples: 2934784
[Parsed_volumedetect_0 @ 0x7f7f1ab04080] mean_volume: -91.0 dB
[Parsed_volumedetect_0 @ 0x7f7f1ab04080] max_volume: -91.0 dB
[Parsed_volumedetect_0 @ 0x7f7f1ab04080] histogram_91db: 2934784
```
 
12:36 PM
that's surprisingly short
 
Wes
there's something super wrong i don't get, is it possible that decibels have different scales, audacity is telling me that 0.5dB is too high
i thought 0.5 dB was basically impossible to hear, what gives
 
0 db is the base
Not "no sound"
 
are you talking about gain rather than volume?
gain is relative, volume is absolute
iirc dB is logarithmic
although I also never really understood it
 
Wes
yeah it's not linear, so the gain is not really useful i think if you don't know what the base is
stupid audacity.
 
Nothing wrong with audicity
 
12:40 PM
s/audacity/@Wes/
 
Wes
possibly
 
not saying I could do any better though, ftr
 
Wes
why would i care about relative if i don't know the absolute value?
it's a dodgy plugin from audacity's forum... so that might be it
i'll try ffmpeg
 
@Wes Do you remember working with ableton?
 
yeh I remember, nice guy, bought me a pint
 
12:42 PM
Everything above 0db is clipping
 
Wes
no idea what that means
what i am trying to do is normalize audio between different clips, but at the same time also set the overall volume to a reasonable youtube friendly level
 
In basic terms clipping means butchering the sound as it cannot be properly represented at that point anymore
Heavy clipping means you blow up your speakers :)
 
var_dump("reasonable youtube friendly level" === $currentVolume + INF); // bool(true)
 
Wes
@Petah what would be the command for a mp3 file?
 
0 dB is louder than -1 dB
 
12:48 PM
@DaveRandom var_dump("loudness war.exe");
 
Wes
nvm, found
 
ffmpeg -i Rick\ Astley\ -\ Never\ Gonna\ Give\ You\ Up\ \(Video\).mp3 -af "volumedetect" -vn -sn -dn -f null /dev/null
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] n_samples: 18706432
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] mean_volume: -17.0 dB
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] max_volume: -1.2 dB
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] histogram_1db: 31
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] histogram_2db: 432
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] histogram_3db: 2675
[Parsed_volumedetect_0 @ 0x7fb3c06043c0] histogram_4db: 10170
 
@PeeHaa javac [[1000s of unreadable arguments]] loudness.war
 
Wes
max volume 0dB
 
This is what I have for my podcasts:
[Parsed_volumedetect_0 @ 0x556e98baabc0] mean_volume: -24.8 dB
[Parsed_volumedetect_0 @ 0x556e98baabc0] max_volume: 0.0 dB
[Parsed_volumedetect_0 @ 0x556e98baabc0] histogram_0db: 2642
[Parsed_volumedetect_0 @ 0x556e98baabc0] histogram_1db: 9871
 
Wes
12:51 PM
so how am i supposed to normalize audio if i don't know the peak volume. why is everything SO HARD
 
max_volume is the peak volume
 
inst the real question, what is "normal volume"
 
0 dB is the highest value you can get
superuser.com/questions/323119/… has a great answer (as accepted answer)
"Option 3" is probably what you want
 
Wes
so if i have 2 mp3 files that both have max_volume = 0 but one sounds much louder, what do i do? :B
 
12:56 PM
one of them probably has compressed audio - what's the mean for both?
 
@Wes louder or has more volume?
 
Wes
-12 and -24
 
Get them both towards 0
 
Wes
@PeeHaa i am not sure what's the difference :B one hurts my ears.
 
Allow to fursther extend anonymous class ・ Scripting Engine problem ・ #79666
 
12:59 PM
Also interesting read:
The loudness war (or loudness race) refers to the trend of increasing audio levels in recorded music, which reduces audio fidelity, and according to many critics, listener enjoyment. Increasing loudness was first reported as early as the 1940s, with respect to mastering practices for 7" singles. The maximum peak level of analog recordings such as these is limited by varying specifications of electronic equipment along the chain from source to listener, including vinyl and Compact Cassette players. The issue garnered renewed attention starting in the 1990s with the introduction of digital signal...
 
Yeah, for music you want a nice wide dynamic range - for speech not so much.
 
Unless you are singing your podcasts :)
 
Which I am not.
 
Shame really
 
No, not really.
 
1:01 PM
lol
 
I am disagree
 
lil dancing too?
 
Even better
 
No. Also, that doesn't work in audio, luckily.
 
Wes
ok i managed to do it, so can i assume 0dB is the default peak volume? like videos on youtube with weird volume are because of that? sometimes videos even from the same channel force me to lower volume. super annoying if you have autoplay on
 
1:04 PM
@Wes It depends :)
 
0dB is the loudest single sample you can have, but, if the level is always in the top 10%, it sounds much nicer than the... Let me show you on screenshare?
 
well, the rick astley mp3 i tested with was from youtube, which was -1.2 dB max
 
You remember watching tv and havig to turn down when commercials come in?
 
this reminds me of a problem i had with some photography app we were building, it was how do we white balance a bunch of photos so the levels are consistent, never did figure that out
 
Wes
i sometimes leave youtube autoplay on while i sleep, and i wake up to terrifyingly loud volume videos
like i jump and crash in the actual ceiling while screaming in terror
 
1:07 PM
@Petah Images are harder I guess (I am probably biased though)
 
Wes
also netflix has episodes of the same series with non matching volume
 
Although you can make clips sound louder by compressing the range (into the loudest elements), you can't undo that.
 
yea it was pretty hard, especially because we had up to 5 cameras, taking photos all day, so differing sunlight conditions, then clear cutting and composing them
 
@Petah Your best bet is to hard-set the white balance in the camera to a predefined value.
 
yea, but there is also the human factor of the photographer
 
1:09 PM
pff, pesky hoomans
what professionals do is take a photo of a white (or grey) card just before taking the photos
and then use these to adjust white balance
amazon.co.uk/… stuff like that
 
this was onsite though, multi hour shoot, with windows
 
yes, sure. You need to redo it when the light changes
 
i get it, though we were tasked with making the software work, not the people unfortunately
 
hehe, yeah :D
 
1:29 PM
@Wes one of the problems is that there is no absolute setting for audio. for displays, 255, 255, 255 is as bright as can be, so people can (mostly) adjust video to be the right brightness. But for audio, there are different max volumes for headphones and loud speakers.
The failure of the electronic industry to find a common definition for audio volume is a massive failure...
 
side question, if rgb is 0-255, how does hdr work? (serious)
 
@Danack The same could be said for print and colors honestly
 
@Petah internally, it represent the values more as floats, rather than integers, and then magic happens when it comes to display it, and the total brightness is adjusted for what you want the end image to be like.
 
Wes
@Danack true
 
@PeeHaa yes, except printing on anything other than white paper is something only professional do most of the time.
 
1:37 PM
It's not just the thing you print on though. It's also the paint that is used
 
also, talking about the technical details of printing is offtopic for the room and may result in being kicked. it's just too much.
 
:D
 
I will just say, that at some point, when the price is okay, and I have spare cash, I want to get flickr.com/photos/danack/6088235483 and flic.kr/p/8dueBA printed on reflective metal plate
 
Not one of them birds? :(
 
They come out fine on paper. But shots where you need more contrast than black ink on white paper need a reflective background to allow more range.
hmm. apparently you can't kick yourself from a room.....
 
1:48 PM
hehe
 
Wes
instead silence would be? in after effects the minimum value i can set is -192dB, but i believe inaudible is somewhere at around -100dB
 
you have some really awesome photos there and gawd, wallabies are so cute, want
 
thanks. My summary of Australia is, hot, racist, pretty easy to get good photos.
 
lol
 
2:05 PM
Too long referer in newer curl versions causes timeout for a request ・ cURL related ・ #79667
 
2:31 PM
...this is not google apparently.
 
 
1 hour later…
3:32 PM
@Danack I have done this with a few of my photos. Turned out amazing. imgur.com/a/pHoc7tJ
Picture really doesn't do it justice.
 
yeah. I was going to say. it's like taking a photo of a rainbow.
 
The fireworks would look amazing on metal. I've never done fireworks photos before, maybe this year I'll give it a go.
 
your camera can capture the full dynamic range of the image, but then outputting it to displays or paper loses the effect.
 
Printing is the biggest challenge for me. I'm usually very happy with how it looks on my monitor, but getting that onto paper is daunting.
 
@Trowski it's really easy. the only thing I would strongly recommend doing is getting a remote cable, so that you don't have to touch the camera. Otherwise it's just something like F8, 2-8 second expose depending on the fireworks, and try to make whatever is in the background be interesting, or at least interesting - rather than just a blank sky.
And yeah....I looked at getting a "real" printer when I was taking lots of photos. I didn't because as I was in australia, in would have been cheaper for me to fly to america, buy the printer, and buy a first class ticket back to australia for the printer, than it would have been to buy one there.
 
3:40 PM
Where I usually go for fireworks that something would be trees. I can probably work with that…
 
if there's wind - try to be upwind of the fireworks. The smoke doesn't play nicely with long exposures.
 
@Danack lol. I've also considered getting one of those 24" printers. Perhaps someday when I have time for another hobby.
@Danack Yeah, makes sense.
Saw this on sale in my RSS feed today: bhphotovideo.com/c/product/1259008-REG/… Very tempting actually.
I don't need that much printer though.
 
> Instant Savings $1,200.00
but you can save so much!
 
ThW
3:58 PM
@Trowski you could print your own wallpaper :-)
 
4:31 PM
Eventually I want to put together frames and make all the wall art in my house.
Maybe even sell a few prints online, put a few dollars toward the grossly expensive camera equipment.
The 24" printer would be enough I think for that. Those are about $2000 when on sale.
 
@Trowski depending on the model, it might be worth looking at second hand ones. For any inkjet printer, as the printhead is in the cartridge, then there's very few components to break in the rest of the printer. Plus it's the type of thing people buy but then never use....so there are ones out there that have only been used a few times that people will want to get rid of.
 
Depends on how much the print heads cost. I looked into that a bit, and replacing the printheads was about $800.
Not to say I couldn't find one with little use. Bonus if it comes with a lot of ink, which is the really expensive part.
 
It occurs to me, a short lambda takes only a single expression, but the proposed match() statement is a single expression. That makes a short lambda that consists only of a single long match statement a possibility.

I am both scared and excited at the same time.
 
4:49 PM
@Trowski pretty sure the cartridges that come with the unit themselves are usually not as full as the replacement ones. Or at least that's been my experience with printers.
 
@Danack Exactly. Maybe I could find a used one that comes with some full-ish replacements.
 
5:17 PM
@Crell Yes, but there's no problem with that right?
 
I don't think so. I'm more excited than scared. :-)
It's more, I'm sure it's legal, now when would I use it?
 
The braces can look a little misleading, but overall I think it would be fine (as in something I might do myself)
$f = fn($x) => match ($x) {
    ...
};
looks ok to me :)
 
$func = fn($x) => match($x) {
$test1 => foo($x),
$test2 => bar($x);
};

$func('bob');
Yeah. Not objecting, more just giggling. :-)
 
@Crell Hehe ok, glad it's not something I've missed :)
 
yesterday, by Danack
@DaveRandom IluTov is working on null short-circuiting. But he needs a better 'real world' example for https://github.com/iluuu1994/nullsafe-operator-rfc/blob/v1/rfc.md - as you have thought about this, do you have one?
@crell do you know of a really good example for that....we have some, but quite a few of them could lead to "you shouldn't write code like that" responses in my opinion.
 
5:26 PM
What's wrong with calling a method if the thing is not null?
 
When is alpha1 meant to be tagged for PHP8.0?
 
@Danack I think @Crell is not too fond of the feature in general :)
 
ah.
 
What am I not fond of?
 
hi guys
 
5:34 PM
@Crell The nullsafe operator (?->)
 
i need help
 
Ah. Yeah, it captures too little information. null doesn't tell me what the error condition is. I'd rather see better support for syntactic Either rather than syntactic Maybe. Which would be kind of difficult to do together at the same time.
 
i am trying to populate a db with php pdo ad getting a UNIQUE constraint failed error
 
My skillset is still too weak to implement that, but I'm happy to discuss design with someone. :-) Once I figure out how to finish partial functions, I hope to get those and func composition in by 8.0. Then in 8.1, if I haven't run screaming yet, I want to look into a bind operator. This is all on the assumption that my paltry skills manage to pull off anything useful.
 
color is my primary key.. the question is can i have multiple rows with red as value if color is primary key?
 
5:37 PM
@Zombievirus no, primary keys need to be unique (i'm pretty sure).
 
dammit
ok thanx
 
Correct, by definition.
 
@Crell But they're two different things. That's like Rusts Option and Result. Correct me if I'm wrong.
 
My Rust-fu is weak, but I believe so, approximately. While "OK, do both" is an obvious answer, the issue is sigil shortage. If ?-> is used for a syntactic Maybe. then what do we use for a syntactic Either? And piggybacking on the same syntax would still leave callers with an is_null() || instanceof check, which is fugly.
 
@Crell ?-> currently only checks for null but if we were to introduce an either type we could also skip Result::error (or whatever it would be called).
 
5:46 PM
Right, but then what do you do with the result?
 
Unwrap. What else?
Note that I haven't used lots of purely functional languages, it's entirely possible my suggestions are stupid :)
 
For the record, neither have I. :-) I've just studied the topic.
$result = $foo?->bar()?->baz()?->beep();

If baz() returns an instance of Failure (think of that as a non-thrown version of an Exception, but no backtrace so it's not slow), then I need to check what $result is to know what broke along the way.
 
@Crell I'm pretty sure that one of the things I don't like about functional programming, is trying to pretend the error cases don't exist by wrapping them in more and more code. In this case, if some api call isn't returning the data you are hoping for, pushing handling that error to another place doesn't seem better to be.
 
If ?-> only allows value-or-null, then I can check $result == null; if true, something failed. if not, we're good.
 
@Crell what if you don't care where it broke?
 
5:49 PM
If ?-> short circuits on null or instance of Failure, then I have to check $result == null || $result instanceof Failure
Whereas if the "generic error, I don't care what" case is simply the base Failure class (or similar), then I need only check $result instanceof Failure.
@Danack it's always easier to ignore type data you don't care about than to restore data you wish you had.
 
@Crell Hm, but why would you accept a Maybe AND Either? I'm not sure I'm following.
 
Also, the thing you describe about pushing the error elsewhere sounds a lot more like exceptions than monadic error handling. :-) Monads force you to think about it close to where it happened.
 
@Danack Additionally, null doesn't mean something broke. null can be an entirely expected value. That's actually what it should be used for.
 
^^ that.
"Monads force you to think about it close to where it happened." what if you don't care where it broke?
i.e. when it's perfectly normal to not have a 'registered address' for a user, as that is optional.
 
Then an exception isn't appropriate either. :-) Exceptions are appropriate for "exceptional things". Monads are still meaningful for flow control that includes error handling.
 
5:55 PM
@Crell Null does not mean an error.
 
Null doesn't mean anything. That's the problem.
 
@Crell you're the only one who said exceptions.
 
In any case, ?-> is adding language level support for a common idiom. Doing anything with some sort of Failure or Expected object is not what is widespread today.
Personally, I am not sure whether ?-> is "good" or "bad".
It's useful in certain cases, definitely, but we also have a silly false idiom and other things...
 
for me, it's a short cut for when you would be writing the equivalent code anyway....without any more useful error handling possible.
 
@Crell Then add a magic method to allow you to programatically respond in a class
 
5:58 PM
@ircmaxell That's on my todo list for 8.1 if I can push my mediocre skills that far. :-)
 
public function __maybeCall($method, array $params);
public function __maybeGet($var);
 
public function __bind(callable);
 
@Crell No, but ?SomeOtherType does. That's the point :)
 
00:00 - 18:0018:00 - 00:00

« first day (3517 days earlier)      last day (1413 days later) »