« first day (1648 days earlier)      last day (3303 days later) » 

5:03 PM
Once we have scalar + return type hints, what do you guys think about docblocking everything? Superfluous? Still useful?
 
They will be useful to summarise what the function does.
 
@Patrick docblocks should contain documentation, not just type information
 
@PaulCrovella but they also make it much harder to read code. Does documentation really belong into the source code?
 
:/ can someone help me out.
 
@HassanAlthaf also still required for mixed types, int|float|Baz. same for return type. nothing is going to change for me :P
@Patrick collapse docblocks by default in your IDE
 
5:09 PM
@Worf If you have to do that, that seems like a sign like they don't belong in there. Also I often read code on github for example.
 
would this be a good var name? $thisIsAName = "name";
 
$name = "name";
lel
 
Perfect isn't it?
 
$this->thisIsAName
 
@Patrick I think it would be good to migrate to docs-only docblocks
 
5:10 PM
hell naw
 
without @param and @return
 
@Patrick If you don't keep API documentation in the source code it's far more likely to not get updated. Plus it's a handy place to read it when you're poking around stuff. And there's tooling (like IDEs) that provide handy pop-ups based on the association. So I'd say yeah, keep it in the source code.
 
And types that are not expressible in PHP should be added with inline comments
 
$thisIsANameIWantToObtainByThisVariable_thisIsAName = 'name';
Better?
 
i.e. function(/* array|Traversable */ $iter) {}
 
5:11 PM
@PaulCrovella But 95% of the docblocks don't really seem to add any value apart from type information and repeating what the method name already suggests (hopefully)
 
Duplicating the type info in the docblock is becoming more and more pointless and in my experience the short comment that is added after @param and @return is usually just noise.
 
Without @param lines how do you describe the arguments purpose?
 
Of course sometimes comments make sense to explain why you do something
But docblocks often seem to explain what is being done instead
 
@Stephen Freetext, for the parameters that actually really need it
For 95% of the parameters that's not the case
 
sometimes you have to comment params @param int $foo Accepted only non zero integers.
 
5:13 PM
Is it wrong that I get confused with the mixed needle and the haystack definitions ? I always mix them up...
 
Good tooling will auto generate the do block based on the signature anyway so I don't see why you'd remove them.
 
@Stephen noise
if a tool can generate it, that's pretty much the definition of useless noise
 
If a couple of comment lines are "noise" I think you have a bigger problem than docblocks
 
That's a serieus question to be honest, I always mix them up, anyone has a good text I couple remember not to mix them up?
 
@Stephen For quality code where methods do not have 200 lines of code doc blocks can easily make up 50% or more of the code
 
5:14 PM
A tool can generate the basic information, it can't identify the purpose
 
@Stephen that's what naming things should take care of
of course sometimes a comment is useful
but blanketing everything with comments also drowns the important ones
 
agree
 
if a docblock just has "@param int $foo" it's noise when there are scalar type hints, when it has "@param int $foo Accepted only non zero integers." it's signal (though the "int" can be dropped)
 
Array $optionsWithConstantsAsKeys is so much easier to comprehend than a few words of actual text
 
TIL (yes, today, after years of php) function names are case insensitive
 
5:18 PM
@NikiC If code has so much useless comment lines, is it still quality code? :-D
 
Anonymous
@Worf we all have one of these moments
 
@Stephen A good parameter name is much more useful if only because it shows up in the signature tooltip ;)
 
so can the docblock text
 
sure it can. but the signature is the one thing you always get and get first
If that already gives you all the info you need, that is best
Without having to start to actually read docs
 
@PaulCrovella At this point it makes more sense to have some assert()'s at the very beginning of a function body. They're also eye-catching.
And clever-tooling eventually could identify if the assert directly depends on passed params…
 
5:22 PM
I've inherited a lot of projects. The ones with meaningful method docblocks are FAR easier to get up to speed with - assuming it's obvious what an argument is used for based on its name is usually a dangerous assumption for all but the simplest of methods
 
@bwoebi when the tooling gets that clever I'll consider relying on just assertions
 
for just the cases they cover
 
Working on a sort of a library which doesn't require you to code the user stuff again and again, with its robust nature
It's work in progress, opinions?
 
@PaulCrovella I don't think it would be too hard to make tooling clever here. It's just that nobody relies on asserts there. And so no need for tooling Which is the reason why nobody puts asserts there… See? ;-)
 
5:24 PM
Recommendations on doing stuff on this would be highly appreciated.
 
perhaps because the existing solutions handle the problem well enough... hmm...
 
@HassanAlthaf updateField and getField don't sound like they belong into a repository
 
What do you mean?
Oh
Couldn't think of another name. :/
 
@PaulCrovella Oh, really?
 
I guess in the end docblocks are a tradeoff between "how many totally braindead comments are added because of the docblock-all-public-methods policy" and "how many useful comments are added that might have been forgetten without a strict policy"
 
5:27 PM
So, why do we consequently not respect what docblocks say?
At least I very often tend to oversee the important bits in big docblocks…
 
@Patrick A recommendation would be nice though.
 
@HassanAlthaf a repository should not return a single field, it should return a populated entity
 
In middle of all the self-explaining garbage…
 
Oh, I see.
What would I call something like this then? A DAO?
 
@NikiC Yeah, add a few useful comments… nobody will notice them ;-)
 
@rdlowrey That seems like a good thing to do at least every now and then. A "thing" I started doing is leaving my cell phone at home for the evening, or day, or two. Good to mix things up and break intrusive habits.
 
@HassanAlthaf not really. Are you executing a separate sql statement for every single field?
 
The field name in the SQL table has to change
 
@HassanAlthaf I don't understand. What problem are you trying to solve?
 
@Patrick The fields folder has an independent class for every field to update and get values of a field in a row
 
5:38 PM
@HassanAlthaf that is your solution. what is the problem?
 
Problem: wanting to update db
Solution: the classes
 
everything currently handled in that UserSystem would be dealt with a single User class to me, ditching most of it
 
@PaulCrovella Currently WIP, I want to write very flexible and robust code so I can easily use the code for different kinds of projects
 
@HassanAlthaf why not save the whole entity at once? that's why people use datamappers and repositories
 
@HassanAlthaf there is no need to have a class per simple scalar field. that doesn't make anything more "robust" or easy to use.
 
5:42 PM
@Patrick You're right.
 
5:55 PM
Can you guys stop adding the wrong @Patrick to the chat? I keep getting notifications :P
 
@Patrick having a full name as account name would help…
 
@Patrick StackOverflow cannot identify both of you as separate users.. prntscr.com/6wjehp
 
@bwoebi Which Patrick are you talking to? :P
 
@Patrick to both
@HassanAlthaf You have browser size like 200%?
 
Nope, 100%
Why?
 
5:57 PM
image is so big
 
Oh, my display is powerful.
Retina Display. ;P
2600 x 1600
 
boooo… a retina display without native resolution… booo :-P
 
sorta everything is normal, and its clarity is beast especially when watching HD videos
 
@HassanAlthaf How it should look like: i.imgur.com/PERXRiE.png
2880x1800
 
nope
Safari is balls, use Chrome
Everything is normal
 
6:01 PM
Chrome leaks too much memory
 
who cur
Better web experience
I have an 8 GB RAM, and that is enough
 
@HassanAlthaf I don't want to restart my browser every few hours…
 
Lol, what is your RAM
 
[I'm the genre of people who can't manage tabs…]
 
Same here.
 
6:02 PM
I always have far too much Tabs open^^
 
I close over 20 tabs open
Like every few hours
lel
 
108 Tabs open…
And my Safari is eating like 10 GB RAM…
 
What
how much is your RAM lol
 
16 GB
 
wtf, how much did you pay for your mac
Is that an iMac or a MacBook?
 
6:05 PM
A bit less than 2k €
 
there are chrome extensions to suspend tabs... though I just close stuff
 
@HassanAlthaf MacBook Pro 15"
 
2k euros!!
in my currency.
 
Turning off the flash plugin has 'fixed' the Chrome memory issues for me.
 
I paid less than 1300 euros
13" 8 GB RAM, 128 GB HDD
The same thing, with 256 GB HDD was little less than 1450 euros
insane!!
 
6:07 PM
@HassanAlthaf Yeah, and now have an SSD and 512 GB
that adds already nearly 400€
 
Why is apple so pricey? :/
 
the bit RAM is not too costly
@HassanAlthaf It's not Apple, but SSDs are pricey
 
1TB barely costs like 50 Euros
No, I am talking about HDD
 
especially PCIe SSDs
@HassanAlthaf in that format they use in the 13" MacBook?
 
what do you mean
 
6:08 PM
@bwoebi a 500gb ssd is not 400 euro...
 
Exactly lol, Apple is a rip off.
But we fanboys still buy
Next time, I am going for MSI.
MSI is sexy af.
Didn't know about it, or wouldn't buy Apple.
 
@NikiC So, how much is it then?
 
@HassanAlthaf That's a SATA SSD
You need a PCIe SSD \cc @NikiC
 
6:11 PM
See, 459$
 
Oh god, it is 400 euros
lel
 
@bwoebi oh well, I was thinking sata here. my 500 gb sata ssd was something like 200
 
MSI is sexy tho
 
@HassanAlthaf It's a 512 PCIe SSD. That's about normal. If you opted for SATA it would be a bit cheaper
 
@Machavity I wish i could. I am on a MacBook, so cant replace hardware lel
 
6:12 PM
That's a M.2 SSD, not a PCIe SSD.
 
MSI is hot
Apple is balls
lel
I can even stay without marrying for that laptop
 
@Charles So it is. I just scanned the title
 
@HassanAlthaf Just to tell… Apple isn't that a rip off. Just some components it uses are expensive.
 
I bought my wife a MSI after the brand new Dell ultrabook I got her crapped out
 
I hate Dell.
So many problems.
 
6:14 PM
@bwoebi The Apple name is probably the most expensive component of any Apple product :P
 
My brother was using it, and he used to bug me to fix them.
@Machavity LMFAO exactly.
 
For a real PCIe SSD you probably want something like the Intel SSDPEDME400G401... 320k iops.
 
They use a Psychological Pricing approach
 
@Machavity It's maybe a 100€.
 
Where they try to create a high quality image by charging a high price
 
6:16 PM
Maybe, but the pricing itself isn't totally unjustified.
 
The apple laptop I have, which I paid like 1300 euros
 
The iPhone or that watch thingy on the other hand…
 
Is like 450 euros
 
Dell typically isn't that bad. But their 14" ultrabooks had about 50% of them with bad wifi. I couldn't keep it connected more than 5 mins and then the wifi would drop from the hardware list (never a good sign). They tried to convince me it was the router despite 2 tablets and 2 phones staying connected
 
6:16 PM
If I go for HP, Acer or Dell
@PaulCrovella but a $1350 Apple with same specs as a $500 HP doesn't taste different. :P
It's just that you sacrifice the sexy design of Apple.
 
@HassanAlthaf same specs? I want to see that HP. [And give me the exact MacBook model you're comparing against]
 
yup
msi itself is giving wayyyyyyyyyyyy better specs for 1300 euros
 
Link?
 
How do I see my model number
 
Click on the apple on the top left, hold alt and click on the first Item in the menu
 
6:20 PM
Model Name: MacBook Pro
Model Identifier: MacBookPro11,1
Processor Name: Intel Core i5
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 3 MB
Memory: 8 GB
 
not that
 
and let me load up ebay
 
Mid-2012 … well… If you compare that against a HP from today… no wonder :-D
 
lol?
This isnt mid 2012
 
 
6:22 PM
I bought it just this November.
*2014 November
 
Yeah, it's the late 2013 model
 
late 2014
lel
 
Morning
 
*mid 2014
 
I typed in 10,1 when searching, sorry
 
6:23 PM
@PeeHaa morn
 
@HassanAlthaf It's the same model identifier
 
And now show me your 500$ HP with same specs
 
ebay aint workin
but yh i saw it in a shopping mall
which is roughly 500$ from my currency
70k my currency
 
no, not ebay… show me it on the website of a vendor
 
6:27 PM
A'ight.
Google for Pavilion 15
Look at that MSI
about $300 cheaper than mine, but way better
:P
 
Let's see… no retina display. A fair bit heavier. Processor speed is a bit slower…
 
A sane OS
/me ducks for cover
 
Also… to be fair… let's compare against the current Early 2015 model…
 
Hey guys, don't know if this is a php question, but how do youtube to mp3 converters work? I'd prefer to make my own
 
@Woodrow That would only be a php question if you hate yourself :P
 
6:40 PM
which has 2,7 GB, 1866 MHz RAM, always PCIe SSD (for 1449€)
 
lol; what language should it be handled with then..?
 
Yeah, only graphics is a bit better @HassanAlthaf
 
@Woodrow Anything but php :)
 
@PeeHaa OSX is the one thing about macs that I'd be interested in using - being able to run photoshop on something with a BSDish underbelly would be just peachy
 
@PeeHaa Yeah, right… the MBP even carries a sane OS…
 
6:41 PM
off topic question is off topic
 
cheers
 
Something *nix'y
 
@bwoebi /me looks at his MBP. Oooooh that windows thing you mean ;)
 
@bwoebi if you put linux on it, right :)
 
@kelunik yeah, that one is sane too… BUT A GODDAMN WINDOWS?!
 
6:47 PM
It's good to be a student, so you get new notebooks without any OS.
 
OMG, the breadcrumbs on wiki page is fixed
:joy:
 
@marcio Fixed? They were always a history, no breadcrumbs.
 
@kelunik they are a breadcrumb now :) well moar or less, but it got better less worst
 
much better, though the "start" link should go
 
I kind of liked that history, even if it was a bit weird.
 
6:58 PM
I have some concerns with this RFC wiki.php.net/rfc/nested_classes because it puts classes and namespaces in a strange gray area
 
But yes, "start" is needless.
 
@marcio it's also from 2 years ago and withdrawn
 
@PaulCrovella you will be surprised where it was linked...
 
reddit?
 
no, wait...
Anonymous Classes were just accepted for PHP 7 https://wiki.php.net/rfc/anonymous_classes Will be merged soon. Next? Nested Classes https://wiki.php.net/rfc/nested_classes
^ it's not wrong to speculate it will be discussed again
 
7:03 PM
Poe's law, named after its author Nathan Poe, is a literary adage which stipulates that, without a clear indicator of an author's intention, it is often impossible to tell the difference between an expression of sincere extremism and a parody of such extremism. Someone will likely mistake the parody for a genuine article, or vice-versa. == History == The name "Poe's Law" refers to a reply posted in 2005 by Nathan Poe on an internet forum about Christianity (christianforums.com), in the context of a debate about creationism. The original sentence referred specifically to creationism, but the "law...
 
@marcio That Phil…
 
@marcio it will be discussed again
 
@PaulCrovella The anonymous classes RFC passed and @JoeWatkins is a very reasonable person that proposed the first nested classes RFC. You are using Poe's law wrong.
 
I was using it in the "unsure if trolling" sense
 
nope.
 
7:06 PM
Yeah, you're looking for "Never attribute to malice that which can be explained by stupidity."
 
@ircmaxell ty for confirm :)
Anyway, I have this concern around this RFC. We all want first class packages and private classes. Nested classes is a way to achieve it, but is it the best way?
 
Do we really want first class packages?
 
isn't it private class Something{} more inline with current PHP OO model?
@bwoebi yes
 
You want them. Probably others too.
 
honestly, I don't. I want first-class packages
typically, inner classes are used because the language doesn't support packages
 
7:11 PM
@ircmaxell Java...?
 
yeah
 
@ircmaxell I think a good majority of people want it (first class packages), around 76% will want it. I just don't appreciate it very much in the form of nested classes.
 
@marcio huh?
 
Anonymous
@bwoebi I have a suggestion for a feature to be implemented in php7. Should I write an RFC?1
 
@samaYo depends on the feature…
 
7:15 PM
@ircmaxell "huh?" refers to...?
 
Do you guys know if you can call a phpunit.xml from another phpunit.xml?
 
yo dawg
 
> I just don't appreciate it very much in the form of nested classes.
 
I don't think its possible or even fessable but I was just curious
 
@samaYo talk it out here
 
Anonymous
7:17 PM
ok, but it's trivial.
 
so is it possible?
 
Anonymous
I will write a sample.
 
@KyleAdams Depends on what you are trying to do. But you can run multiple test suites
 
Last night I realized I value union and intersection types more than I thought I did.
 
@LeviMorrison oh yeah?
 
7:19 PM
AFAIK
 
I mean, this is a basic case: type Iterable = array | Traversable;
 
@KyleAdams I don't think PHPUnit supports entities, which would be how it would be possible.
 
But I realized you can essentially have algebraic data types with it too:
class None {}
class Some {
    public $value;
    function __construct($value) {
        $this->value = $value;
    }
}
type Maybe = None | Some;
 
you can do that with null as well: type Maybe = null | Some;
I fail to see the difference there
 
You can't put methods on null ;)
 
7:22 PM
@PeeHaa and @Danack The easiest way for to explain is through stackoverflow.com/questions/29780998/… Where each Module has a test folder and each tests folder has a phpunit.xml that I want to call from one main phpunit.xml. Now I know I could create one giant test folder at the root but each module is - in essence - independent of the next module. so I was just curious
 
@ircmaxell I just meant that for PHP it's preferable to have class visibility through packages other than through nested class declarations.
 
@ircmaxell Sure, in this particular case null works out. In a second I'll maybe have a better demonstration.
 
Class as packages looks like a weird design decision: new Some\Thing <-- if we use nested classes we no longer know if "Some" is a namespace or a class and that's annoying.
 
I wish I had say over this but when your manager is a java developer >.> Welcome to idiot land. We do manage to keep the convention that Some is a name space and not a class. But I can see your argument
 
@LeviMorrison in this context, what's the difference between union and algebraic types?
 
7:27 PM
@KyleAdams I would just write a simple script fo dat
 
@ircmaxell Algebraic types are a sum of product types.
 
Then again. I always write script instead of reading the documentation
 
There is not really a difference between a union type and algebraic data type. That's the realization.
 
@KyleAdams You may have just gotten the paths wrong if the one in the root isn't running any tests.
 
@marcio very valid
 
7:29 PM
@PeeHaa Thats what I might have to do. @Danack That is a good point - Ill look into it
 
@LeviMorrison I think the difference is in how the compile treats them (validating that all cases of arithmetic types are handled, but ignoring that for unions)
 
@ircmaxell That's not a requirement of algebraic data types. That's just pattern matching.
 
I'd recommend asking on the issue list at github.com/sebastianbergmann/phpunit for being able include one phpunit xml file from another. It would be a useful thing.
 
@LeviMorrison I mean outside the context of patterns.
 
They are separate things.
 
7:31 PM
@iroegbu not to mention that to add another class inside a "class package" we would need the concept of "reopen classes"... with namespaces we don't have this issue. In ruby it's called "monkey patching" - aka "nightmare"
 
so, what's up, peoplesies
am I only one who thinks that nested classes are kinda pointless ?
 
@tereško Probably not. I don't think they are pointless, though.
 
new Foo\Bar\Baz, spells disaster
 
@LeviMorrison pray tell, what's the usecase that I am failing to see ?
 
@tereško private classes
 
7:34 PM
@tereško Access/visibility control.
 
@LeviMorrison please, just clear this one up : you are NOT trying to implement "friend classes" in php
 
@tereško No, not friend classes.
 
please, for the sake all that is good and pure
 
I assume you mean C++'s friend classes since I know of no other kind of friend class. No, I don't want those.
 
then I don't see any other type of visibility/access control that you could be trying to add
 
7:37 PM
@KyleAdams You can also use <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="testsuite1.xml"/> to include xml snippets (but not complete phpunit.xml files)
 
@marcio wouldn't that result in resurgence of "one large file of everything" trend among some PHP developers ?
 
L-/
 
@ircmaxell This showcases having methods and pattern matching to see the difference: gist.github.com/morrisonlevi/b79f2da94aa64b856eab
 
/me is extremely skeptical about both the usefulness and capacity of harm, when it comes to nested classes
 
@tereško if try yo achieve class visibility with nested classes, without the ability to reopen a class from another file to add the nested classes, maybe. That's why I don't like it.
 
7:40 PM
I don't see the algebraic quality there. All I see is a union with pattern matching
 
@tereško but: class visibility != nested classes
nested classes is one way to have class visibility, the way I don't prefer.
 
@ircmaxell Algebraic data types by definition are just a sum of product types.
That is the algebraic quality.
 
so union types == algebraic types if they can support non-primitives?
 
I guess technically they have to support recursive definitions.
(I do that in the example)
(A Branch has Trees in them, and Trees are Branches or Leafs)
@ircmaxell What does primitives have to do with it?
 
primitives are non-product types
 
7:45 PM
Primitives can be classified as product types, I believe.
Depends exactly how it is defined.
> A [...] form of product type is the unit type: it is the product of no types. ~Wikipedia: Product type
 
eih
 
If a product type can have no values or n values, then it can have at least one.
 
that's a degenerate case though
 
I don't get your point there.
 
8:09 PM
@NikiC or @bwoebi is zend_class_entry used polymorphically? Meaning is there any common elements shared with other data structures?
 
No, ce doesn't share anything AFAIK
 
so I can reorder members?
yay :-)
 
@ircmaxell what for?
 
using it polymorphically :-)
 
@ircmaxell Hey, I am interested. I'm looking at implementing union types and that could be useful :)
 
8:16 PM
@ircmaxell I mean… what are you implementing at all?
 
@LeviMorrison I'm about half-way through a proof-of-concept :-P
 
Oh, that is what you are working on :)
I found an interesting little bug when I was working on it last night:
 
Ah okay ^^
 
<?php

function f(): null {}
> Fatal error: Cannot use 'null' as class name as it is reserved in /Users/levijm/Projects/php-src/tmp.php on line 3
Teehee
@ircmaxell Keep me posted. I intend to work on this tonight after work.
 
prompt> back
frame #0: ex() at /Users/Bob/php-src-X/fail.php:12
frame #1: prim() at /Users/Bob/php-src-X/fail.php:6
frame #2: {main} at /Users/Bob/php-src-X/fail.php:16
prompt> ev debug_print_backtrace()
#0  unknown() called at [/Users/Bob/php-src-X/fail.php:12]
#1  ex() called at [/Users/Bob/php-src-X/fail.php:6]
#2  prim() called at [/Users/Bob/php-src-X/fail.php:16]
unknown is a nice function, yea…
> /* can happen when calling eval from a custom sapi */
oh…
 

« first day (1648 days earlier)      last day (3303 days later) »