« first day (2048 days earlier)      last day (2897 days later) » 

4:00 PM
Eh... maybe that's better in a common package.
 
user895378
How many "common" things really exist, though?
 
@Trowski uhm, that'd be probably then just a single trait there…
 
user895378
The Struct is so trivial that duplication isn't a big deal
 
for now just duplicate it, we can merge it later if needed
 
user895378
In general I think we abuse DRY
 
4:01 PM
True. Struct is really just a dev tool anyway.
 
right
 
It's not strictly needed
 
user895378
there's real cost to de-duplication in that I have to go hunting elsewhere to understand how things work
 
@rdlowrey THIS.
 
user895378
For things that are trivial my approach is usually: fuck it, I'll duplicate and it costs me nothing and makes my life easier
 
4:02 PM
I might just skip using it altogether.
 
user895378
Well, it's very valuable if you're (ab)using public properties for performance internally
 
user895378
It's saved me headaches more than once
 
@rdlowrey The framework gods shall smite you for this blasphemy!
 
@rdlowrey my approach too.
@Trowski yeah, they all get it wrong :x
 
Yep.
 
4:04 PM
@rdlowrey Well, that depends
 
A certain level of DRY is fine, but somewhen it just is impossible to navigate the code…
 
If you ever need to change, and you forget that you've duplicated it, it leads to some real PITA bugs.
 
For simple, low-level code I think the duplication makes sense.
 
@MadaraUchiha that's true, … as you said, it depends. but you don't ahve to push DRY to the extreme.
 
user895378
@MadaraUchiha sure, I just mean in the context of very trivial things. These kinds of things are always a case-by-case basis
 
4:06 PM
@bwoebi My general approach is "if you copy paste anything more than once, you need to rethink your DRY"
 
@MadaraUchiha Sure, I know also projects with the other extreme, where it's hard to change behavior at all. But that's also not necessarily a very bad thing.
 
@bwoebi It's not necessarily bad when you need to change behavior but it's hard to?
 
@LeviMorrison If that's offensive, you haven't hung around in here much with teresko :-)
 
When is that ever not bad?
@Jimbo Heh, I recall teresko calling me a "noob who got all of his rep through jQuery" at least once.
 
I would wear that title proudly.
 
4:10 PM
@MadaraUchiha The problem is that things often interdependent … not being able to change things also ensures a degree of stability.
 
@bwoebi Not being able to change things because the code is fucked up is not stability :P
 
in a way, it is.
 
Apr 21 '12 at 10:37, by tereško
how did this noob earn so much rep ?
 
Forced stability
 
I'm going to release all my code obfuscated starting now
 
4:11 PM
Apr 21 '12 at 10:37, by tereško
oh .. jquery and html .. right
:D
 
@PeeHaa finally!
 
@bwoebi That's... really not stability.
 
hmmmm uglify.php
 
@PeeHaa That's much worse ^^
 
:P
 
4:12 PM
If you have a bug and you can't fix it because your codebase is unmaintainable, you aren't providing stability.
At best, you're providing job security.
 
yay
\o/ job security for everyone in room11
 
You're providing the debian definition of stability, at least.
 
$$ for everyone in r11
 
@MadaraUchiha If you have a bug, you'll have to strg+f all occurrences of a copy.
it's not nice, but it works.
I just sets the bar of changes much higher.
 
4:14 PM
@bwoebi search and replace does not work.
 
@MadaraUchiha no, search and manual replace.
 
Search and replace is a surefire way to introduce bugs of "oh, my search pattern missed that instance, so now that one is not updated"
 
Damn you all. Now I really want to write a php uglifier
 
If anything, you do something like github.com/facebook/jscodeshift that's essentially a search/replace that actually understands your code.
 
@MadaraUchiha that's why the author of that code decided to not change var names etc. of copied text
 
4:15 PM
@bwoebi Again, job security :P
 
o/
 
If it's an isolated case, and they're relatively close in the code
Meh
 
@MadaraUchiha The manager won't be interested it. The problem is shifted to the poor followup.
 
If you have 5 versions of the same function/class on your app, scattered everywhere across the layers, you usually have a problem.
 
@MadaraUchiha Pfff … I rather mean like code snippets are C&P'ed everywhere
 
Wes
4:17 PM
hold the doooooooor afternoon
 
Especially if you have magic autoloading going on and it's not obvious to tell which piece of code is using what
 
not slightly different funcs/classes
 
@bwoebi That usually what happens though
 
@Wes 'noon
 
in this case not
 
4:17 PM
@Wes buongiorno
 
Wes
@PeeHaa buon pomeriggio
 
@bwoebi Great, nothing to worry about then :)
 
Wes
Time: 2.16 minutes, Memory: 98.00Mb
OK (1307 tests, 12262 assertions)
i'm winning
 
Ekn
'noon
 
Wes
4:28 PM
\o
 
Would be nice if you could judge this accepted answer (which is wrong IMHO): stackoverflow.com/questions/2917183/…
 
@le_m Using whitespace in names is a terrible idea to begin with :) myabe you shoudld add that to your answer.
 
Wes
yeah it is wrong indeed. php converts some characters, namely . to _ and does also other things, iirc
 
Whitespace is terrible precisely because of PHP quirks like this one ;)
 
4:34 PM
Upvoted for great justice btw
 
haha, thanks
 
@le_m Not just because php (although the entire language is awful). The entire idea of using whitespace is terrible imo no matter the language
 
@Wes the test case to assertion looks like it doing large scopes
more then a unit =)
or that each unit contain a very cyclomatic complexity
 
@RonniSkansing Don't go there ;-) I've tried and @Wes got mad
madder* :P
 
Wes
4:36 PM
:P
 
:D
 
what are you testing?
 
Wes
stuff
 
Wes
i would rather chop my own private men area than having ~1 assertion * test
 
4:38 PM
oh I was thinking more in reveerse
if each test case contains a 1000 assertions then each test case must test a unit (or a few) of high cyclomatic complexity
or handle a scope larger then a unit. maybe like functional tests
or integration tests
 
Wes
i know some of these words...
 
Finally setup a non-parsed header CGI script with Nginx. \o/
 
@Wes the report gives back the CRAP score of each function right? is it a really high number?
 
49 secs ago, by Wes
i know some of these words...
 
Wes
4:41 PM
@RonniSkansing it doesn't usually reach 5
the most complex one could be 10, maybe
 
@PeeHaa :D
 
@Wes oh so each test just runs alot of units
 
@kelunik :P
 
Wes
@RonniSkansing they are very pedantic tests, if it's what you mean
 
Stupid Apache doesn't support dynamic document roots based on environment variables parsed from cookies.
 
4:43 PM
@kelunik what exactly is a non-parsed header script?
 
Wes
and, i test against the interface rather than implementation, so even if a method is just for example delegating to something else, it gets fully tested nevertheless
 
@bwoebi Basically HTTP Request → STDIN → Script → STDOUT → HTTP Response
Raw request sent to STDIN instead of environment variables.
 
@Wes I like that kind of ocd, I just think it's a pain to do sometimes
 
Wes
but actually a huge part of those tests are automated. it's assertions that get run automatically while testing other stuff
 
...
 
4:46 PM
@bwoebi Why?
 
because I was talking bullshit :-D
 
> -bash: /bin/rm: Argument list too long
doh
 
heh
 
@PeeHaa Use xargs.
 
@PeeHaa stop arguing with bin/rm
 
4:47 PM
If you're using find, use -delete
 
@kelunik Does this look right find . -name '*' | xargs rm?
cc @KevinMGranger ^
 
@PeeHaa why not just rm -rf . ?
 
@PeeHaa How about rm -rf *?
 
I don't use xargs, find has -exec and -delete for a reason. xargs rm looks daaaangerous
 
But yes, otherwise it's fine. xargs splits into reasonable chunks to not exceed the length limits.
 
4:49 PM
@KevinMGranger Now I'm scared :P
 
What about @bwoebi's suggestion?
 
Uhhhmmm
 
It might be fine, it just makes me scared at first glance :P
 
How about rm -rf / ?
 
yeah I could indeed just del that thing @bwoebi @KevinMGranger
 
4:49 PM
@Saitama won't work with relatively recent gnu coreutils
 
@Saitama Did something similar yesterday.
 
@kelunik oh?
 
@KevinMGranger aww...
 
err . might not work because you'll still be in the directory, but going up one level and doing it might
 
@kelunik ?
 
4:50 PM
@PeeHaa heh do one rm for each
 
On purpose oooorrrrr....
 
@bwoebi chmod -R abc . while being in the root directory. ^^
 
oh god
 
ooops.
 
4:50 PM
A colleague of mine did that once
 
Was just a fresh test server fortunately.
 
now I am tempted to boot a vm
 
I had to manually compare everything and manually fix it
 
what happens
 
@RonniSkansing Try it.
 
4:51 PM
ok
 
Wait, maybe I can give you the exact command.
 
I've already done something similar (locally), but OS X has a feature to repair permissions (i.e. reset to system defaults)
 
did you mean chown?
 
@bwoebi It's funny, because nothing worked anymore. Autocomplete with tab resulted in cannot read from /dev/null, no command could be executed, because missing execute permissions or command not found.
 
While we are sharing horror stories I once had to manually recover an overwritten mysql database (copied the wrong way)
For 1 second I thought: wow that went fast. But then I realized I copied an empty database over a full one \o/
 
4:55 PM
@kelunik not too bad … at least I've only done it in /var …
 
Fun times
 
:P
 
user895378
4 hours ago, by Ocramius
That's why I talk about BUSINESS VALUE, and not correctness. We can talk about how much one can perform onanisms on "oh my god this is so restful" for entire days, but whether it's actually useful to produce money is a completely different story
 
user895378
^ If someone said this in an interview I would hire the fuck out of them
 
You rming the directory worked fine @bwoebi @KevinMGranger @kelunik \o/
s/You/yes
 
Wes
5:11 PM
sorry
 
5:24 PM
@rdlowrey Well, this either means they're just repeating something they've heard somewhere else … or that they actually have some idea …^^ you need to still discern these two groups of people :-P
 
Umm... I needed some help.. I was trying to install mint, after I installed Windows, and successfuly resized the windows partition, and made the left up space for installing mint, but it's prompting me to create a swap partition, so.. my question is, what size should the swap partition should be?
 
are you using a ssd?
 
No.
 
great
how much ram you got?
 
4 GiB.
 
5:32 PM
give it the same amount swap
 
Thanks! 😃😃
 
np =)
have fun with mint
 
Will do.😉
 
@kelunik so, you are suggesting on the ml to slowly deprecating property declarations without value (in favor of null default) in order to make property values unset() by default if they have no default value, right?
(in PHP 8 I mean)
 
user895378
@bwoebi very true. A good bullshit detector is an important part of the interview :)
 
5:46 PM
@DaveRandom yep. that I am
 
@bwoebi No, not at all.
I don't suggest deprecating anything at all. I just want consistent behavior with the current one.
 
@kelunik depends what you're consistent with … you can be either consistent within typed props or within anything nullable (which includes the untyped props)
 
No, with current property defaults (which is null).
i.e. there shouldn't be a need for = null in the declaration only because it's a typed nullable.
 
@kelunik You can as well say that only untyped properties are null by default (as non-nullable types are not null by default)
 
Parameters are a different topic. They're never default null.
!!> (function($foo) {})();
 
5:55 PM
[ 7.0.0 - 7.0.6 ] Warning: Missing argument 1 for {closure}(), called in /in/65jY8 on line 1 and defined in /in/65jY8 on line 1
 
@kelunik Why are you now talking about parameters? I'm talking exclusively about properties
 
[ hhvm-3.9.1 - 3.12.0 ] Warning: __invoke() expects exactly 1 parameter, 0 given in /in/65jY8 on line 1
[ 5.5.0 - 5.6.21 ] Parse error: syntax error, unexpected '(' in /in/65jY8 on line 1 <br/><i>Process exited with code <b title="Generic Error">255</b>.</i>
 
@bwoebi Because we only have non-nullable types in parameters currently.
And for properties they are essentially null, just access is prohibited.
 
@kelunik well, actually, (Foo $foo = null) (the current only way in PHP 7) to write a nullable parameter is null by default…
We're changing that with ?Foo in 7.1
Would be quite consistent in that way even.
 
@bwoebi parameter*
@bwoebi But Foo $foo = null will still work?
 
6:01 PM
@kelunik yes, for BC reasons. Possibly we will deprecate it once, but not before 7.0 is EOL
 
Wes
i just remembered at my mum's home i probably still have a giant inflatable elephant
 
(to not force users to have it either not working or E_DEPRECATED on some versions with same code on all supported versions)
 
@bwoebi Adding a type shouldn't alter behavior IMO.
 
@bwoebi if that really is going to be the case we should push people to it sooner rather then later
 
@bwoebi we will?
 
6:02 PM
@kelunik That's the main point I agree with and you should post that to the ml.
 
I'm not sure we will
 
@NikiC Possibly.
 
And if we won't, I wonder if we shouldn't support Foo $bar = null for properties
with the same semantics of automatically making the property nullable
 
I'd rather not
because you can reassign $this->bar
 
@NikiC I hope we will, unfortunately it breaks code. But we could probably have an easy tool that adds the ? to all Type $foo = null signatures.
 
6:04 PM
and then you suddenly can assign null to something which is Foo
 
@Ocramius I'm pretty sure that your suggestion of only supporting nullable types for now will lead to "add nullable types everywhere --- because a nullable type is still better than no type!"
Also it doesn't really solve anything, because the question of whether =null is required or not stays the same
@bwoebi only if it's explicitly initialized to null though?
I mean, there's no "suddenly" about it
It would just work the same way as parameters
 
@NikiC which is weird, still.
 
I'm not a big fan of this, but I can see how we'd want to do it for symmetry
 
with parameters at least you don't overwrite anything, you just use the default.
 
#lazyweb is void return type being reverted?
 
6:06 PM
@kelunik Tool is trivial ... being compatible across PHP versions is the problem
@marcio As of now, no.
 
But with properties you overwrite something requiring Foo and holding a Foo value to null … just because of its initial value… sounds quite wtf to me
 
@NikiC Yes, sure. Deprecate, then remove in 8.0 or so, when 7.0 is long EOL.
 
@Saitama Been there.
 
:D
 
6:07 PM
@NikiC ty, will that be an RFC?
 
@kelunik Deprecate == Fatal Error, for high-quality code
This means you cannot be compatible with PHP <= 7.0 and whenever we deprecate this
 
@Saitama I had fucked up the LVM volumes and the partition table at the same time, somehow, back then :x
@NikiC which is not a problem, when 7.0 is EOL. And you still can actually. Just remove the typehint.
 
@kelunik Err... how is adding a type not supposed to alter behavior?
Adding a type makes the handling of the property more strict
Of course that alters behavior
 
@bwoebi :P
 
@NikiC If I add ?Type and the property is always either null or Type, it should just work.
 
6:09 PM
@NikiC It should not alter behavior if property types are matching with the new type.
yeah
 
@kelunik And if you add Type it shouldn't?
 
never mind, saw the chat history xD
 
@marcio Probably only if union types passes.
 
@NikiC In this case it still shouldn't, if you set it before access.
 
@bwoebi I can say the same for ?Type. If you set it before access...
 
6:10 PM
I would prefer null instead of void whether union types passes or not but if union types passes it becomes more compelling (or at least I think it does).
 
@NikiC true…
 
@NikiC It shouldn't, if null is assigned somewhere.
 
@bwoebi Also, as you're union type-y, what about the Foo|false case I mentioned. Would that default to false?
 
@NikiC no.
 
@bwoebi Whyever not?
 
6:11 PM
just like public boolean $foo does not default to false
 
@LeviMorrison me too. But that was voted already. Anyway, void would be even more uncomfortable with union types on. So it's nice to see consensus in case of union types at least.
 
@NikiC also, false|null would default to what? null then? but why not false then? This is simpler and unambiguous.
 
@bwoebi Simpler and unambiguous is always requiring a default
 
@NikiC right. Except in case you want it explicitly uninitialized.
 
@bwoebi yes ... so we actually agree?
 
6:13 PM
When would you want it explicitly unintialized?
 
@NikiC I'm not sure whom I agree with.
 
Just that odd unset case for magic access?
 
@bwoebi bool. :P
 
@LeviMorrison Uninitialized as in the default state. Before you initialize it
 
I agree with your point at the same time I agree with @kelunik … you both have valid points and I'm not sure what to agree with.
 
6:14 PM
heh
 
@NikiC I assume that was the "implicitly uninitialized".
 
@LeviMorrison context is whether ?Type should automatically get a null default value
 
Doesn't HHVM require you to initialize typed properties in constructors?
If they aren't valid after constructor they fail?
 
@LeviMorrison As only Hack supports typed property, there can't be a dynamic condition on it
I don't know what they statically enforce though
 
HHVM works off the same source as Hack though.
So what happens in this situation:
<?hh
class MyClass {
  private int $foo;
  public function __construct() {

  }
}
 
6:17 PM
@LeviMorrison error
I mean under the Hack type checker
HHVM will obviously just ignore everything
 
Wes
what is the issue with nullable types? can someone sum up the problem? :B
 
Currently all properties are initialized to null or alternatively behave as if they were, correct?
And basically that's not desirable here (or at least for some people it is not), correct?
 
@LeviMorrison The current proposal is that all untyped properties are initialized to null, but all untyped properties are not initialized (to anything -- throw on access), unless they are typed with a nullable type, in which case they are initialized to null
 
If we adopt a check after ctor is called and forbid making new instances via reflection without ctor what edge cases are left?
 
Which, yeah, is not desirable to some people
 
6:22 PM
I think I'd prefer that they are always initialized after construction – this is what all sane languages do.
This goes back to why I think unsetting the property is really unwise.
 
@LeviMorrison This is a problem for objects that don't use an ordinary constructor (e.g. use named constructors)
 
Wes
@LeviMorrison this is what i've suggested, but joe said would've been too slow
 
@NikiC Don't those usually have private constructors that the named constructors use though? More specifically what is the issue?
 
@LeviMorrison You also couldn't use such properties as simple structs (class with public properties -- no methods, no ctor)
 
@NikiC Correct, because we can't default construct them. That's a desirable property, isn't it?
 
6:24 PM
I think the current variant where it throws on access is fine
It's more general
@LeviMorrison All sane languages ascertain that at compile-time though ^^
 
Wes
@NikiC i've proposed to make the check when the instance is passed around, eg:
class Foo{ public Baz $baz; }
function y(): Foo{
    $foo = new Foo;
    return $foo; // error, it's incomplete
}
function x(): Foo{
    $foo = new Foo;
    $foo->baz = new Baz;
    return $foo; // works, all fields fulfilled
}
 
@Wes I suspect that has a non-trivial performance hit.
We can't just cache the "is it initialized?" check because of property unsetting.
(Or at least it's more work and error prone)
 
Wes
the one i'd have is have all fields temporarily nullable (if not explicitly nullable) during construction, and switched back to non-nullable (unless they were explicitly nullable) after constructor has executed
and error if the types are invalid
 
I'd prefer it if typed properties were just syntactic sugar for getters and setters.
But we don't have that feature.
And I'm really glad we didn't vote in the one that was proposed.
 
@Wes "passed around" is a super fuzzy concept
Say you assign the object to the property of an other object. Did you just "pass it around"?
If that other object is shared with other code, you might say yes
But there's not good way to pin that down
 
Wes
6:32 PM
@NikiC yes, including that
 
(Or there is, but only with a significantly more complex type system.)
@Wes Assigning to a property may effectively pass it to another function
Through shared state
 
can't the check happens just on the first time a typed property is accessed?
 
@marcio You mean a check for all properties?
 
Wes
ie it is allowed to be incomplete only in the scope it was created in
 
@marcio I don't think that's viable because you may want to access some properties before you finished initializing all the rest
@Wes The point is it's hard to formally define (and implement) what it means to leave the scope
 
Wes
6:36 PM
i imagine it being so
 
@NikiC why would you depend on an unitialized typed property to initialize a second one?
I meant to check only a single typed property when it's accessed for the very first time.
Only the first access would get all the performance hit, and it's still safe as long as it's not a reference
 
@marcio if you mean only check a single typed property, then that's how it's currently works (and imho this is also how it should work)
 
@NikiC I voted yes because I thought it worked this way but never really checked the patch
:D
the only issue is references, but I don't care about references in this case
 
do any of you use a mysql client, other then the regular cli one?
 
I've used workbench
 
6:43 PM
@rdlowrey a) because it's (currently) possible to close a connection and potentially reopen it on the same instance later b) because STATUS_BAD is required in order to make effective use of reset() (which is quite definitely useful as it restores things like prepared statement handles to a valid state).
I was also kicking around the idea of pushing updates to the connect promise about status changes (potentially command promises also), which could be good for debug logging and getting server load metrics
@PeeHaa commit the file with an x permission then?
 
@PeeHaa workbench once fucked me over real bad
 
git does understand permissions, it just doesn't understand them on windows (but windows does not break existing ones)
 
I have had a hard time returning to it
 
@DaveRandom I develop on windows :)
oh from the server you mean
duhhhhh
I knew I said something stupid the moment I hit enter :)
@RonniSkansing What happened?
 
all the tables aligned to the bottom and out of sight and was impossible to unlock
it was some shitty bug
serves me right for not backing it up
before it happend
 
6:49 PM
:)
 
user895378
@DaveRandom I guess my point is that instead of exposing those details to the user we should create an API that hides that complexity
 
user895378
I shouldn't have to care about that level of implementation granularity in a userland API. I should have a method I can invoke that actually matters to me.
 
Wes
@RonniSkansing sqlyog ?
 
free
=)
 
evenin
 
6:53 PM
o/
 
Wes
@RonniSkansing yes, community edition is free
 
@rdlowrey you don't need to check that info, but I don't see the point in not allowing you to get it if you want that info (for debug logging, for example). Most of the time you would just do this if you want to use reset():
 
oh
thanks will check it out
 
try {
    yield $conn->doSomeServerOp();
} catch (ServerOperationFailedException $e) {
    if ($conn->getConnectionState() == Connection::STATE_BAD) {
        yield $conn->reset();
        yield $conn->doSomeServerOp();
    } else {
        // something really weird is going on, log it
    }
}
We could have an auto-reset option I suppose, but even so I'd rather not make that data actually unavailable
There are various subclasses of ServerOperationFailedException but the parent is there so you can handle a generic failure as well
 

« first day (2048 days earlier)      last day (2897 days later) »