« first day (1490 days earlier)      last day (3474 days later) » 

2:00 PM
@AndreaFaulds yeah it is, but just asking if there's really support for that (outside of this room) ...
 
If there's not support, I'll make there be support!
 
how does hack handle scalar hints, does it coerce to the hinted type ?
 
@JoeWatkins I'm pretty sure hack's hints are just strict hints.
 
that's in our favour then ...
 
Oh what the hell, valgrind doesn't work on Yosemite :<
 
2:03 PM
do any of the eval things online support hack ?
 
@JoeWatkins 3v4l.org uses HHVM, so I'd imagine that if you do <?hh //strict it'd work.
@JoeWatkins So, apparently strpprintf works but zend_strpprintf doesn't, wtf
 
@AndreaFaulds yeah I dunno, really should use the latter anyway, I wasn't looking properly this morning ...
it is used elsewhere, it's strange alright ...
<?hh //strict didn't work ...
 
Morning
 
@JoeWatkins 3v4l.org/K4PUN works for me!
 
woops
I forgot to name the function ...
I'm sleepy :D
 
2:06 PM
alcohol and league are not thursday activities.
 
Holy shit, what the fuck? Facebook has just announced the withdrawl of Hack?!?!
10
 
DAMN IT
 
hehe got me
 
Haha, nice...
 
2:09 PM
Damnit @AndreaFaulds
 
@AndreaFaulds c'mon!!
 
I follow a golden rule that if I get friday-fooled I have to star the link -_-
 
@AndreaFaulds don't exaggerate on Fridays or I already know that it's a fake before I even hover to see the link…
 
@bwoebi :p
 
@JoeWatkins it still depends on how strict strict is. If it's real strict hints, not sure. If it's with lossless casts, I see more chance here.
 
2:12 PM
who approved .blackfriday, what the hell were they thinking?!?!
 
@CSᵠ Americans?
 
lol :)
 
I mean, it's a pretty big commercial event in the US.
 
so big it needs a tld
for xxx or sex makes sense
 
There's a TLD for everything now
 
2:13 PM
@JoeWatkins about:addons > "ask to activate"
 
Can we get .php yet?
 
sponsor it?
 
Imagine a world where room11.php exists
 
@AndreaFaulds imagine the typos
 
2:14 PM
@CSᵠ hah
 
@AndreaFaulds This, and I think it would also be useful for passing values to internal functions which would otherwise perform an implicit cast.
 
it definitely needs registering 1!!!!!!!!!!!!!!!!!!!11
 
@TheodoreBrown Ooh, good point. You could use this to avoid the horrible cast behaviour of internal functions for certain things.
 
@AndreaFaulds it would probably redirect to some random gambling/porn site
 
2:15 PM
I wonder if there are any gambling-porn sites.
 
@tereško Nah. It'd be "index.php: All you need to know about index.php" "index.php tutorials, index.php advice, index.php news" "php tutorials" "php certification" "Become a Zend Certified Engineer Now"... that kind of auto-generated spam site
 
@AndreaFaulds These names seem fine to me.
 
Better ask an expert... @PeeHaa ?
 
@AndreaFaulds you might also want to take a peak at github.com/CS-/typeConvert
i feel we're in the same bowl somehow
people suggested
work-in-progress no idea where to take it....
 
@AndreaFaulds since I have managed to work at places with much shadier set of "principles", my bet would be on gambling (especially because those are not entirely NSFW)
 
2:18 PM
@bwoebi These safe cast functions would make strict hints much more palatable
 
@AndreaFaulds no, I don't want a five argument function be called with each argument passed through an explicit type cast. That's what implicit lossless conversion is for. It'd read ugly.
 
@bwoebi I see your point. On the other hand, when do you have a function with five integer or float arguments?
 
@AndreaFaulds often enough. e.g. have a date. d, m, y H, i. 5 integers.
 
@bwoebi array_map('to_int', $date_values);? :p
 
can someone from USA explain to me this shit: how have you ended up in a situation where "Voter ID laws" are even an issue ?!
for fuck sake, here you have to get a passport at the age of 16 by law
 
2:25 PM
@tereško Because 1) Not everyone in the US has ID, 2) Such laws exist primarily to make it difficult for demographics that don't like the Republican party to vote
 
@AndreaFaulds func(...array_map("to_int", [$d, $m, $y, $h, $i])); Well, would work too, but doesn't look really user friendly^^
 
Yeah :/
 
@AndreaFaulds I know what the goal of those laws is .. my question is: "why the fuck 1) is even a thing?"
 
@tereško Uh, because not everyone needs a driver's license or a passport.
Also, some people care about their privacy.
 
strange systems
 
2:28 PM
In my case, I currently have no valid photo ID. This doesn't cause me any problem in day-to-day life, except I can't buy alcohol.
 
as I said .. it seems strange to someone from Baltic nations
 
Yes, mainland Europe is really big on ID cards. The UK is quite different, and I think the US is too.
I mean, here, there was massive opposition to the Government introducing ID cards.
 
maybe it's because we have a different distinction between "privacy" and "anonymity"
 
@tereško Whenever a system seems fucked up and bullshit, about half the time it's because it's serving someone's interests for it to be like that. And the property owners in the USA have never liked poor people voting, so amazingly they've made it quite hard for people to vote. It's a feature not a bug.
 
I used rdp to do something on OS running in vmware machine. /me needs to go home
:)
 
2:35 PM
@Danack The American bourgeoisie fear the power of the proletariat if they were allowed to have any influence. So they ensure they don't.
 
@Leri also, you should be quite ashamed of yourself
 
@AndreaFaulds PHP should include a FormatException like C#.
 
@tereško Because of windows or because of what I have done... hmm, maybe both
 
2:48 PM
How do you not have ID?
Drivers license?
Passport?
 
Hey everyone, who can I talk to here about the chat bot?
 
Herro, I had no idea we actually had a chat bot?
 
@Fabien I have no ID because I don't need one. I'm not travelling abroad and I don't (and can't) drive.
Granted, the reason I have no passport is actually because it's currently being renewed :p
 
and it is not required to provide an ID to open a bank account ? Or to get a official job ?
 
2:55 PM
@tereško I think you do need ID to open a bank account, and I had one when I opened it years ago. I don't have a job just now.
You don't need ID to vote in the UK, though.
 
@Haney They're done manually - just do [tag:cv-pls] and then a link.
 
it is broken
 
so there's no bot?
 
What about buying age restricted stuffs from Tesco/Asda? :P
 
2:55 PM
@RonniSkansing what is broken
 
one moment @Haney
 
@AndreaFaulds You need a ID passport to vote in Latvia. And you are required by law to have an ID.
 
@Haney There's no bot - there is a related tool that picks up things that people have suggested are bad questions, github.com/Room-11/cv-pls.com but we don't have any bots in this room.
 
Groovy, what am I staring at then @RonniSkansing? The tool?
 
2:57 PM
@tereško Weird.
 
@Danack And the scraper broke... yesterday?
 
@Haney I don't know - I haven't used, it just aware that it exists I suspect if you direct your quest to @crypticツ they would be the best to ask.
Is it doing something naughty?
 
well... it seems as if something broke yesterday... I did what was supposed to be a "stealth" search change yesterday... Coincidence?
 
Or could it be Satan ?
 
Unlikely
 
3:00 PM
I dunno....this is the PHP room....
 
I'm visiting you on a day pass from the .NET realm
 
lol =]
 
Yes, yes, we heard that Microsoft has unleashed that on OSX and Linux now.....
 
Don't you need ID for paracetamol? Or some other meds.
 
@Danack I suspect low adoption but it certainly is a positive effort
 
3:03 PM
@Fabien or subscription meds in general
hell ... even buying Chloropyramine (antiallergic agent) needs a note from a doctor
 
prescription meds only require you to verify your address and name verbally here. Oddly.
 
.. oh .. wait
yeah , you can get meds without an ID
 
alright I'll get back to you via Github when I know something. Peace out PHP folks
 
the chain is a bit longer
 
@Haney Yeah github is probably best but @crypticツ or @hakre are usually around later in the day.
 
3:06 PM
 
3:19 PM
oa-res-27-29:php-src ajf$ sapi/cli/php -r 'var_dump(to_int("blah"));'

Fatal error: Uncaught exception 'CastException' with message 'Value could not be converted to integer' in Command line code:1
Stack trace:
#0 Command line code(1): to_int('blah')
#1 {main}
  thrown in Command line code on line 1
oa-res-27-29:php-src ajf$ sapi/cli/php -r 'var_dump(try_int("blah"));'
NULL
:3
@TheodoreBrown ^
 
@Haney o/
I have seen you a couple of times actually getting back to people regarding bugs / features on meta. Is this something you plan on keep doing?
 
@rdlowrey what is the state of Arya, do you think it could be used for the moment properly?
 
3:35 PM
How do you guys feel about that? try_int to return NULL, to_int to throw an exception?
 
@PeeHaa that's literally my job
I like getting back to people
this site ain't NOTHING without the people and community
gotta keep it real, as it were
I have to balance talking to people with doing teh codez though so you'll find I go 1-3 weeks at a time with low or no interaction with community, followed by 2-3 weeks of bug fixin'
The secret to life (for me) is to never forget your roots. I'm not above anyone. I was a big fan of this site before I worked here. I'm still a huge fan of it, only now I have some power to meaningfully improve it. So I do.
Hope that explains my philosophy; sorry for the novel
 
@AndreaFaulds I like it; C# sets precedent for this behavior.
@AndreaFaulds What do you think about using more generic exceptions (e.g. OverflowException and FormatException)?
 
@TheodoreBrown the Try... pattern is hella powerful, specifically when returning a struct type that can't be null. If I got 0 back, was it actually 0 or unsuccessful? The bool result of Try... solves it.
 
@TheodoreBrown It'd be super-simple for you to implement in PolyCast: function to_int($value) { if (($result = try_int($value)) === NULL) { throw new CastException("Value could not be converted to int"); } else { return $result; } } :)
 
@AndreaFaulds Yes, but then the exceptions can't contain useful info (such as whether the value overflowed or has an invalid type).
 
3:46 PM
if PHP has out/multiple return params, could include a string in the fail case of the exception
 
@AndreaFaulds And why not just false?
 
@TheodoreBrown That could be done.
@Leri FALSE is... problematic.
 
In what sense?
 
It's not the nicest of values. It makes the function's return type in HHVM be mixed, not ?int. It's also weird, FALSE shouldn't really be used like that.
 
@rdlowrey How would I effectively unset the proxy option from artax? So it goes back to default.
 
3:48 PM
@AndreaFaulds Give me a sec and I'll finish a prototype implementation.
 
@Haney Love you already
 
I love me too, so hey at least we have that in common. ;)
 
Glad SO finally actually looks into this meta thing :P
 
@AndreaFaulds I see nothing weird in returning false. try_do_x it tried and failed, therefore try was false. This is how I feel about it. And I don't really have hhvm in mind usually. :-)
 
@TheodoreBrown It'd be easily doable in the C code too. Atm the internal function returns 1 on success, 0 on failure. But I could return a string on error, and NULL on success.
 
@Leri Yes, but if it succeeds, it doesn't produce TRUE.
 
"it does not work" issue resolved as a boss
 
alright, off to coding. Later peeps.
 
later @Haney!
 
@AndreaFaulds Yes and that'll be the first function doing that in php. :D
Seriously, it (returning false on failure and different things on success) is pretty common practice in PHP
 
3:52 PM
I still think NULL is nicer. FALSE was just be a kludge so it'd error for a nullable typehint, but that's horrible.
 
good people...i have a yii application written using yii 1.1.3..am trying to add a new ace admin theme to it..how do i change the theme ?
 
+1 for not false
 
note the application is currently using classic theme
 
@pmaingi you hire a developer
 
3:55 PM
in yii framework
 
@BenjaminGruenbaum Oh what's that? I'll just click on this link that goes to a totally legit meta question and offer up my opinion on the ma... god damn it.
 
I was thinking about SRP and DataMappers. If you have a DataMapper which is related to User data manipulation and this mapper has methods for getting/inserting/updating/deleting data. From the point of view of SRP aren't there 3 different responsibilities: 1. Extracting data, 2. Saving data, 3. Removing data

But if you look from the side of Processing User data in general, doesn't it mean all those 3 things could be in the same class?
 
@BenjaminGruenbaum That was a surprisingly good read, it's certainly convinced me. Seriously, guys, you need to read that. :/
3
 
@BenjaminGruenbaum ,,|,,
 
@Haney good languages solve that by returning an enum. In the TryParse case it's even simple and you can use the built in Optional. So in a perfect world things that aren't value types also could not be null and TryParse would return an optional.
/s/Optional/Maybe
 
3:57 PM
@BenjaminGruenbaum how is there domain .blackfriday?
 
@PeeHaa Your OpCacheGUI code looks very nice!
 
btw hi, how are you
 
@ziGi sounds like someone has been talking to teresko :P
 
@BenjaminGruenbaum haha actually not so much recently
 
@tereško is the one usually talking about data mappers and SRP.
 
3:58 PM
I have been experimenting with code and I am thinking about stuff like that
 
I love that you guys are into the whole Friday thing
 
hahah interesting, no, I just went to implement some mappers and it made me thinking
 
@ziGi inb4 @teresko will send you a link to CQS or something.
 
Reminds me of Standard Grade Physics class :D
We loved Friday.
OK, maybe just me and the two girls I sat next to...
 
@BenjaminGruenbaum what is CQS?
Google gives me a Hedge Fund
 
3:59 PM
Command Query Separation - adding something and querying are two different things.
 
Yeah, that's what I thought
 
Personally, I think CQS isn't really important and that the only reason you have these things to worry about is because PHP can't query databases like it queries collections. That's a language problem.
It's not expressive enough like Haskell or Scala that you can process expressions via metaprogramming facilities and on the other hand it doesn't have those capabilities built in like other languages.
For example, C# doesn't have a too strong type system - so it has the ability to query the database like an array or a list built in via the language integrated querying syntax.
 
yeah, I have heard of that, that makes it faster
 
I'm surprised no one automated it yet in php. People in this room are a) smart and b) know the php compiler very well.
 
(talking about C#)
 
4:02 PM
-.-
 
They're probably just disinterested. Maybe they think SQL is good enough and that separating that layer out is better than exposing it language-wide.
 
I am not sure what to say at the moment rather than I think it would make life easier for people since it would be easier to program without adding mapper layers and writing queries on your own every time
 
Well, the classical quote for the scenario is: Never underestimate the value of not having to write code. There are no defects in code you never wrote.
 
lol, that's just trolling
 
4:05 PM
@TheodoreBrown Not necessary to include the value in the error message, it'll be in the trace
 
@BenjaminGruenbaum abstracting it makes sense anyways, it doesn't have to be stored in a db, could be an api, a flat file or whatever. By abstracting it your domain logic doesn't care about how that happens. Editing a 100 files and breaking everything because someone wants to change the storage sucks (been there...)
 
the fact that someone wrote a code and posted it somewhere does not mean it is perfect
 
@AndreaFaulds I'll change this
 
@Patrick yep, same here, I really hate it
 
@Patrick Are you talking to little-boxed people?
 
4:06 PM
but I guess, that is how you learn
 
@TheodoreBrown Implementation-wise, probably not best to implement try_ by catching an exception. That's slow, especially in HHVM
 
@Jimbo You don't like our troll regular? :*(
 
@AndreaFaulds I know, but at least the code isn't WTF-y
 
@Patrick There's only one decent regular JS guy in here and that's @FlorianMargaine :-) After hanging around in here for a while he became much nicer...
 
@Patrick that's not how linq works though. It exposes an IQueryable interface, as long as it has a LINQ provider it'll work. Switching DB providers, or loading in memory collections, or working against a NoSQL DB or even ancient stuff like XML files is absolutely free.
 
4:09 PM
Anyway, it didn't answer my question, I am not concentrating on the Mapper part but on the SRP in this case
How would you resolve this, what problems might arise if you put them all in the same class and used them to obtain the Domain data from them
 
@iamdevloper I tried forming one called *ASYNC, but we could never all show up at the same time.
 
@Jimbo Thanks! Also don't forget to thank @mralien for the awesome design
 
@BenjaminGruenbaum CQS is about method btw, not classes
 
@TheodoreBrown There are some other problems, though. Throwing four different kinds of exception makes handling it very difficult. I don't like that.
And is it important to catch each of those cases individually? Why?
 
@ziGi then forget about the mapper thing and just create a Reader (or Finder) and Writer class. Or just make a Repository that can persist and fetch items, I have even seen uncle bob give an example like that. If that's the worst thing in your application, I wouldn't worry about it...
 
4:15 PM
yeah true
SoC, right
 
@AndreaFaulds You can always catch the most general exception. Some users might already have handlers for these specific exception types which would catch them.
 
@TheodoreBrown What, RuntimeException? Too generic.
 
@AndreaFaulds Generally you wouldn't try to handle exceptions the moment they're thrown, would you? You would have handlers for specific types at a higher level.
@AndreaFaulds What should it be?
 
Ok guys, I wish you a pleasant day/evening, enjoy your weekend
 
@TheodoreBrown There are cases you might want to.
@TheodoreBrown CastException, but creating 4 different subclasses of CastException would be silly. I don't think we need multiple exception types. It wouldn't be used much, and it complicates the implementation.
 
4:18 PM
wow, 38 clicks on that friday link in the js room, here and the c++ room. Not bad.
Lol, looking at the analytics - not a single person used IE
 
@AndreaFaulds C# throws a generic FormatException for cast errors: msdn.microsoft.com/en-us/library/…
 
@TheodoreBrown Yeah, it throws just one. I think we should throw just one, CastException. We could make CastException a subclass of something more specific than RuntimeException if we wanted.
 
If I may weigh here as someone who uses C# - there is an easier solution in C# for this - their int.Parse and int.TryParse (/double/decimal/etc) APIs are just old.
C# would not have written this methods that way today.
 
@AndreaFaulds It also throws OverflowException if an integer would overflow.
 
Just like Java is writing its new APIs without them.
Using exceptions for that is silly.
If you want to do what all the cool kids like C++14, Scala, Swift, Java 8, C#, Haskell etc etc etc are doing, work with optionals.
 
4:23 PM
@BenjaminGruenbaum What's the easier solution in C#?
 
The way it would've been written today is:
int? int.Parse(string s)
Which would return a Nullable<Int>
Wait, that's Nullable (Maybe is Haskell)
Although nullable is a horrible name. Here: msdn.microsoft.com/en-us/library/1t3y8s4s.aspx
 
@BenjaminGruenbaum Which is what try_int is :)
 
@AndreaFaulds right, but without the type safety or runtime safety (unless you add optionals to PHP type hinting in an RFC). In a dynamic language you just have to check I guess.
 
@BenjaminGruenbaum I think we're slowly moving towards nullable safety :)
 
My point was - if you're going to imitate other languages - don't imitate their recognized mistakes. int.Parse throwing is a mistake. You couldn't express the fact that it returns something that might be an integer before - it was simply too weak of a type system.
The type system is actually still very weak in C#, they had to bake Nullable into the language - you still can't do Either which is silly.
 
4:28 PM
@Fabien Just create two clients, one with proxy, one without?
 
user895378
@Fabien I think you can $client->setOption(Client::OP_HTTP_PROXY, null) can't you?
 
user895378
Did you see if that works?
 
Trying now.
yeah null works it seems
 
user895378
As for being able to tell when an error is the result of a proxy problem ...
 
@DaveRandom helped on that.
 
user895378
4:37 PM
I may need to introduce some more exception types for things like that.
 
user895378
A little part of me hates that verbose list of Client::OP_SUPER_LONG_OPTION_NAMES ...
 
heh
 
user895378
I might change those constant values to lowercase strings so I can type things like $client->setOption('http-proxy', null) instead without breaking BC.
 
user895378
And commit to not changing the string values of the constants.
 
@rdlowrey It's pretty damn difficult to determine that, anyway. Unless it's a socket-level error, most of the time it's going to be almost impossible to determine whether an problem is the result of a proxy failure or the remote server in a standardised way
 
user895378
4:41 PM
@DaveRandom It really is difficult.
 
user895378
It can be done, but it's kind of at the point of diminishing returns for all the added complexity required.
 
@BenjaminGruenbaum I don't think it's a mistake. In some cases you want an exception. In other cases, you want to return NULL.
 
@AndreaFaulds What you really want is to convey what the method did. You don't want an exception or NULL. The problem is you have no real way to express that in PHP.
 
@BenjaminGruenbaum ?
 
@AndreaFaulds When you think logically about converting a string to an int you don't imagine NULLs or exceptions.
At least I don't, It's not that exceptional to not be able to parse user input.
 
4:49 PM
@BenjaminGruenbaum It really depends.
 
@AndreaFaulds it does depend on what you're actually doing - but I argue that returning an optional is the best of all worlds. Not for PHP since that'd cause a culture problem but in general.
If you're sure the value is there you can force unwrap it and get your precious exception. If you're not sure you can conditionally unwrap it and get the same thing as try_parse returning a bool.
 
PHP doesn't have optionals, though.
 
Yeah, I'm not saying that's what I'd do in PHP. PHP has a terrible type system.
Another alternative is to return NaN, although JS does it and people hate it.
It makes some sense: "It always returns a number, but that number doesn't always make sense"
 
NaN kinda works. But it's not perfect.
You can't have to_float return NaN.
And NaN isn't an integer
 
Yeah, again - that's a typesystem problem.
 
4:53 PM
Not really. Integers don't have NaNs.
 
In PHP I'd probably just do NULL. The way people write code in PHP doesn't really favor exceptions.
 
I want both. It really depends on the scenario.
 
user895378
Well an unexpected exception is (relatively) cheap in PHP because it doesn't matter if you crash your script -- it was going to be killed off momentarily anyway.
 
user895378
Of course, that leads to the current undesirable situation where people often use exceptions for flow control and not just exceptional situations.
 
@BenjaminGruenbaum Well played sir, well played.
 
4:56 PM
Hey @NikiC, what do you think?
 
@rdlowrey I think we sometimes make the mistake of thinking of PHP as a general purpose programming language
 
user895378
:)
 
user895378
guilty, lol
 
Me too :P
 
I think a lot of people do so.
 
4:59 PM
They're all wrong :D
 
I also think a lot of people.
Like @DanLugg @DaveRandom @Danack
<3
 
@AndreaFaulds I changed FormatException to just extend Exception (as C# does) github.com/theodorejb/PolyCast/commit/…
 
WHO DARES WAKE ME FROM MY SLUMBER??
 
@PeeHaa True fact bro slice.
 
Oh it's you
 

« first day (1490 days earlier)      last day (3474 days later) »