« first day (3401 days earlier)      last day (1771 days later) » 
01:00 - 17:0017:00 - 00:00

01:23
o/
it's a weird night. I'm about to try a game named "American Truck Simulator". Not sure if send help or no.
did you already attach truck nuts?
you mean, with my two hands?
I did attach trailers to cars and jeeps nuts more than three times, but I don't think I really could say I get that
 
4 hours later…
05:18
Any YII expert here ?
I want to inline dropdown(status) edit in gridview::widgets, So any one have idea how to achieve without kartik plugin.
 
2 hours later…
06:54
@Trowski yes, exactly
o/
07:06
Is it appropriate to link to implemented RFCs from the docs?
@Girgias almost forgot that i did a benchmark for msthematical code as well and compare it to C even beberlei.de/2019/03/25/…
@Tiffany what do you mean?
I'll explain it when I'm more awake. I keep typoing from my phone
Case and point
Long term I suspect JIT + pure PHP extensions will be the way it goes
Well most likely PHP/FFI
07:24
@MarkR only iff jit perf gets near c ext perf though, which is still far away
Maybe we should make it MUCH easier to write exts, interfacing with rust maybe?
Who knows, maybe PHP will just compile to web assembly
Ah yes thst would be cool ;)
I can't see extensions as they are now being the future though, the internals of PHP are just too poorly documented.
There is a remedy against poor docs :)
Yes, but seems unlikely the expert knowledge needed would ever be free to go documenting a thousand different macros and structures etc
So I can certainly see businesses preferring to invest in native-php development rather than extensions. The ramp-up speed is just so much higher.
07:34
true
@MarkR this is exactly why I want to provide PHP API to create PHP extension, and this way is much more interesting for me, despite the fact that I have poor knowledge in C language
And having success in running native assembly code within PHP I can imagine all possible libraries providing binding to native structures and CPU extensions (SSE3, AVX, etc) to speed up processing of code.
08:38
@MarkR now i am wondering if preloading fixes the problems of wasm ext startup costs
09:18
I doubt we'll ever get extensions in php, but php will be accelerated to the point that there isn't much need for the typical extension
also it's quite normal for documentation to be contained within code, in systems as complicated as php, and not just open source
even if there were documentation, you would still have to read the code ... you just can't fit everything that is relevant to every possible developer within documentation, the information required is only contained in code ...
also, morning all
Happy Friday
I thought it was Thursday for some reason
nah we're doing friday already
09:48
@JoeWatkins careful now, you don't want to break your own friday rule with that doing. Sounds like effort.
moin
Hello guys
New here
@NafiuLawal Fatal error: Uncaught Error: Class 'here' not found in /rooms/11/php on line 48529926
god damn markdown
@da
@DaveRandom already?
I mean... it's Friday, all I really do at the best of times is make glib remarks, that goes double on Fridays
10:02
@DaveRandom I get it now
@DaveRandom dork
@DaveRandom btw, still busy this week?
insanely so, yes. But should calm down by Wed (deadline on Tues)
that's a hard deadline as well, where the word "dead" is quite applicable
Alright, cool, I'll bug you then
@DaveRandom :S
@heiglandreas I assume the doc-en repo is now more or less final, right?
I've started the job hunt again, officially. Applied to two places yesterday, and will apply to more when it's a more acceptable hour since my sister is sleeping in my living room ATM.
10:05
since you are American and you are hunting something, I assume that involves big guns?
@DaveRandom all of them
10:18
@JoeWatkins I found your play reminded me on this.
Hello.
10:35
@NikiC I hope so!
its frustrating to argue with people about the JIT, they gladly take 5% benefit without any thought about the costs
en, doc-base and de are already moved. es is currently "in progress" and the others will follow in alphabetical order. I also think I found the issue with the outdated .en-revisions.ref
@heiglandreas cheer on
the costs only matter to about ten people
also people arguing against "magic methods", so confusing, "function operator +" is just a different way of spelling public __add. it makes no sense
10:39
yeah I saw the yet-another-draft thread
@beberlei Right
It might not make sense from an internal POV. But by using interfaces to define such "magic methods" the code becomes more explicit.
and you can f.e. check with an "instanceof" instead of a "method_exists" whether some method is available
When a function expects an argument of type "Stringable" there is no need to use a method_Exists inside that function to be able to call __toString() (or whatever method that interface defines)
@heiglandreas That's a different question
Magic methods vs interface is a legitimate discussion
__add vs operator+ is not
The question about interfaces is mainly how useful that would be in practice. Something like Stringable is clearly useful, but does it really make sense to accept a parameter of type Addable?
10:55
Well when that was the thing, then I'm absolutely with you.
IMO Addable would make sense (perhaps a differntly named one for multiple mathematical operations) if you pass Objects to a method that does some math with them...
yeah, you need to group the interface, like MathType (name placeholder) to avoid interface overkill and group add, mul, sub, div and such. Which then might force people to throw exceptions if operation not supported, uggh
foo(int|float|(Addable&Multiplyable) $x) yay
Just to make sure the Object passed in understands what will be expected....
@beberlei It's hard to meaningfully group them. Outside of proper integers and floats barely anything supports division
@NikiC yeah, both solutions have their cons
11:04
Am I the only one who doesn't like operator overloading? :(
probably not
@heiglandreas you don't mean "Addable" in that case, you mean "can be converted to a number" which is a different thing
DateTime + DateInterval makes sense, DateInterval is "addable" but float + DateInterval makes no sense
Mornigns
Sorry for the offtopic, got a noob question: How do I configure the @php.net email so I can send email from it? I've tried adding it into gmail as an alias, but I get username / password invalid.
11:34
I have mine working in gmail, but I did it so long ago that that I don't remember how
Jan 20 at 14:27, by Joe Watkins
nobody has ever installed a mail server properly in the entire history of mail servers and installing things
^ related
What's up with all that operator (casts, math ops etc.) overloading recently?
and: why do people want to have it so badly?
I just don't get it
I think I figured it out. You're not supposed to send through the php.net smtp servers, when you add it in gmail you should add the @php email, but when configuring smtp add smtp.gmail.com and your gmail username and application password.
@bwoebi cause they're cool?
What makes them cool? I see nothing like improved readability or understandability there
@bwoebi i think its nice syntactic sugar to have, i have a lot of mathy code that could benefit
one thing i don't know, how much "cost" would it mean in terms of memory to have all these new magic methd pointers on the ce given that probably only a small subset would implement them
@beberlei I think it's fine for mathy code ... but only for that. I would be okay with something like MathType. If it's actually Mathy code
11:41
people are going to misuse it, its not a reason not to have this though, also if the good use case is "only mathy" things
@beberlei that's sort of my problem with it :-D
but you can argue this with everything
thing is I don't do much math, but I'd hack some of the operators to mean something in my context.
I think that would end up the way most people use overloading. Is that a bad thing ?
i am not sure about all the bitwise magic methods, i don't see how they can be used and do exactly what they stand for
@beberlei pretty much how cout/cin hacks the << operator?
11:47
I'm not sure that C++ should be taken as a good example of anything at all
@SorinNunca hehe yea :)
Anyone want to chime in on the visibility discussion in github.com/php/php-src/pull/5068?
@beberlei We can add an extra level of indirection for that
similar to what iterator methods do
12:16
@beberlei actually thinking about it, bitwise operations on an IPAddress structure might make sense
@DaveRandom yeah, i thought about Set like things for |&~
similarly an arbitrary buffer of bytes for crypto-related stuff
yeh
and shifts for ip addresses makes sense
a little bit
buffer shifts can also be useful in general binary encoding formats
I know I have wanted << to work with strings before now
can't remember the specific use case, but I remember it being legit
haha so we are at cout << "foo" again :p
12:20
well sort of, but I wanted it for actually shifting bits around in a buffer, not that madness :-P
It would also be useful for implementing arbitrary precision math
12:53
@DaveRandom Yeah, you'Re absolutelöy right! Don't see "Addable" as the final name for something that can be added to another number-kind-of-thing ;-) Naming is hard and in that context (hopefully) everyone understood what was meant
@heiglandreas naming I'm not so worried about, it's more that I'm not sure the interface makes sense - at least, not without strong typing describing the nature of the value that will be used as an operand. I'm not 100% what it should/would look like, but combined with generics it should be possible to make a useful interface which says "this can be used as an operand for this sort of operation, but only if the other operand works in this specific way"
I am worried (or rather annoyed) by naming :-)
addable, arrayable, wattable
naming is hard, and API design is hard, and I'm generally not a huge fan of magic methods that aren't associated with some sort of type constraint, but an interface that just says nothing more than "this can be added to stuff" isn't useful
imho
it needs to be more specific than that
class PeeHaa implements Abusable {}
At least that one makes sense
As in I am a class act
new act;
13:06
But yeah I can abused. But nothing can be arrayed
no, that should be Castable<array> (or nothing)
The discussion before was more along the line of not having magic methods without a propper Interface. And you have the same issue with a magic method __add...
Interface ArithmeticOperators
SO instead of not having an interface I'D rather have Addable.
Sure but why settle for something that we all know is broken
13:08
But an ArithmeticAddable would be even better
No one was settling on anything there ;-)
Good good :)
I think we should just add method overloading + definition tables and have done with it.
I definitely leave thge naming part to people that know much better what they are talking about than myself ;-)
definition tables?
Some way of declaring which real functions name to call in response to which argument types.
13:11
Why tho
Well otherwise operator+ would have to accept everything, or just one thing? Although I guess that's not quite the case with union types in 8.0
> would have to accept everything
/me waits for somebody to ask for an Acceptable interface
class Matrix implements OperatorMultiply<Matrix> { .... }
Bet that one would throw it through a loop
I don't see why you are proposing method overloading and then talking back about operator overloading
Hi, one question please.. Can we toggle variable value from one tab to another using php
13:23
Internal type safety for different operator values, but with union types you can have the engine kick in and accept multiple types anyway while TypeErroring the rest itself, so it's not needed
Hi, one question please.. Can we toggle variable value from one tab to another using php??
No need to repeat your self
We saw the question
@MudassarSaiyed Stop that please
Either your question is not clear or nobody wants to help
There is a form in one tab I want to use that form values in another tab
@MudassarSaiyed SOunds rather frontendish. As PHP is usually used in the backend that doesn't really compute....
13:45
@heiglandreas while I'm generally on board with that, I don't see the point of an interface if it doesn't actually add semantics... without some sort of type-based contract, instanceof Addable doesn't tell you anything more than method_exists('__add'), nor is it any more user friendly
I'm actually on your side btw, I feel like I'm not coming off like that :-P
I just don't see the point of adding a type when the type doesn't really tell you anything about the behaviour
and crucially I don't want to add a pointless type for the sake of it, when there may be potential for retrofitting something more useful in the future
(which is not to say it's not possible to add something useful now, either)
@MudassarSaiyed what do you mean by tab? tabs toggled with js?
The type can be used in a function-signature, the method_Exists not. So you can create a function calculate(WhateverAddable $a, WhateverAddable $b) and
don't need any calls to method_Exists inside that function
Or something returns WhateverAddable and you just know (and more importantly StaticAnalyzers know it) that you cann call a certain function without having to test whether that function exists or not....
sure, makes sense, but not if there's no guarantee that two Addable instances are actually compatible
(see aforementioned float + DateInterval example)
^ that
That's why I used the Term WhateverAddable
13:55
I'm basically thinking it needs to be generic
BTW: The magic method __add doesn'T protect you from that also
i.e. Addable<int> or Addable<DateTime> etc
as a DateTime object might implement that as well.
@heiglandreas It doesn't pretend to though. You'd be typing against specific classes instead, not Addable.
@heiglandreas no indeed, my point is that I don't think we should have a non-generic version if it would then prevent adding a generic (useful) one in future
13:57
Well. If we implement a magic method __add, then AFAIK we can only use that with one function signature. So either __add(<numeric>) or __add(DateTimeInterval) but not both....
that's all, I don't want any shooting of own feet
I would prefer __doOperation(int $opcode, $firstOp, $secondOp) signature for operator overloading instead of tons of magic methods
My working example wraps all information into the Hook object instance github.com/lisachenko/native-types/blob/master/src/…
@heiglandreas union types though
i.e. Addable<int|DateTime>
@lisachenko not totally against it, although I feel like it would tend to result in less readable code, and it removes the strong semantics that come from breaking it up into individual ops
Like if I only implement add/subtract, that method will end up getting called pointlessly an awful lot, and there will be no way for me to inspect an object and find out what it actually implements
I also want the abstract types that @heiglandreas is talking about, which you couldn't really do with that
unless I'm missing something
Hi there! I'd like to know how much memory is used to store a boolean variable? My naive solution was this:

$startMemory = memory_get_usage(true);
$boolean = true;
$endMemory = memory_get_usage(true);
var_dump($endMemory - $startMemory);

Though the end and start memory are the same. It probably has to do something with GC? Is there any documentation on how much memory is used to store booleans?
@BrentRoose php allocates a block of memory which is what you are measuring
14:05
a zval is a fixed size
And do you know by any chance how large a zval is? :D
(also look at the zend_value def)
since that contains a struct of 2 int32_ts, it's probably going to be 64 bits on all platforms
Gotcha, thanks!
ditto double is 64 bits everywhere (for all practical definitions of everywhere) I think
everything else is ptrs to various things, which obviously add to the overall size only is as much as the size of the thing they point to
cmb
cmb
sizeof(zval)==16
14:11
everywhere?
again, for all practical definitions of everywhere
cmb
cmb
well, Win x86 & x64
that presumably can be expanded to just x86 & x64
cmb
cmb
I think so, yes
which more or less covers "all practical definitions of everywhere" :-P
Forgive me my ignorance, I'm not into C, but where does those 16 bits come from? Looking at _zval_struct, it looks like there's a lot more going on than only using 16 bits? github.com/php/php-src/blob/master/Zend/zend_types.h#L302-L328
14:17
16 bytes
@BrentRoose 16 bytes, not bits ;)
oh bytes
It's basically 8 bytes value payload, 1 byte type tag, a couple bits flags, and 6.5 bytes empty space ;)
That's interesting! What's the empty space used for?
alignment
14:18
That
well well
makes it faster, basically
Well, sometimes it's also used for something else, e.g. bucket offsets in hashtable entries
Ok thanks for the information, really appreciate it :)
We tried packing it in 8 bytes using NaN-tagging at one point, but it didn't really work out. The packing/unpacking makes things inefficient
14:20
I'll stick an RFC up for debug type over the weekend, outstanding Qs are a) name and b) resource labels (vs just aiming to get rid of resources entirely).
googles NaN-tagging oh yes I totally know what you mean nodding in overcompensation
you and me both
lol, literally first result is one of Niki's articles
Floating point representations are a guarenteed way of making most people's heads hurt, including mine
Doesn't Lua do Nan-tagging?
I forget if JS JIT does it
14:24
Yes, I think both V8 and *Monkey use it
I thought they would since they store everything in double IEEE anyway
It's harder for us because PHP has a legitimate integer type
And integers do need the full 64-bit of payload. So one would basically need to have a separate (allocated) type for large integers...
oh Nan tagging in PHP would suck for sure
Did ever actually happen?
It's interesting you mentioning bit flags, since the reason I came to ask this question is because I'm writing a blogpost on using bit flags to store boolean values. Besides being a nerdy thing to know, do any of you know of practical uses in userland where it'd make a significant difference?

Going by Nikita's assertion of 8 bytes of payload, you could store up to 64 boolean values in one zval, which is a huge difference compared to using 64 zvals, though I can't come up with userland applications where it would make a real impact
@BrentRoose That wouldn't make sense. How would you handle refcounts?
Making booleans more memory efficient is an exercise in futility anyway
14:28
@BrentRoose I recently learned the bittorrent protocol uses it for availability of pieces
oh you mean as a bit map
It makes the bytes going over the wire +/- 8 times less
What's wrong with just using an integer?
Also I mostly use easy flag handling and not for size improvements
14:30
$bits = 0; $bits ^= 1; // turn LSB on
cmb
cmb
@Sherif nothing, unless you need more bitfields
@cmb Use a string!
The reason I consider using them is indeed to easily handle multiple flags, not for performance improvements
@BrentRoose I'd usually call that a "bit set" or "bit vector" and store it in a string if memory usage is your primary concern. Array of integers is a good trade-off between memory usafe and performance.
arbitrary precision accomplished
14:32
It's a commonly useful data structure for compiler implementations
I use a string in my bloomfilter implementation.
works fine
@PeeHaa most network protocols pack flags as bitfields
it's a little redundant these days, but it's all about reducing wire sizes
Why push more data over the wire than needed
well, alignment
but yeh
@NikiC would you use a string and use the array offset notation to read one value?

So

$flags = '0001000'
$flagSet = $flags[3] === '1';

vs

$flags = 0b0001000;
$flagSet = (bool) (0b0001000 & $flags);
14:34
I mean unless you are a js developer in which case it is your top priority to push as much as you can
@BrentRoose well that's 7 bytes
@BrentRoose You'd actually store 8 bits in each character
Ah yes
also it relies on '0' == false, which is a safe assumption in PHP but not in a lot of places
I.e. to get bit $bit you do something like (ord($str[$bit >> 3]) >> ($bit & 7)) & 1
@DaveRandom <feels ill>
the other problem with strings @BrentRoose is you can't shift them
well, not with << and >>
Sure you can
You gotta pack them first, but you can
Just use gmp
Makes things so much easier
1 min ago, by DaveRandom
well, not with << and >>
:-P
From a programmer's perspective though, how does one keep track of which bit is stored where with the string approach?
14:38
obviously it can be done, but not natively as a trivial operation
@DaveRandom Once you import it to a GMP number you're fine
@BrentRoose Math
and constants
@Sherif sure, but that's an abstraction layer, it's not a "native trivial operation" :-P
@BrentRoose Just like in old K&R pointer arithmetic ... Bit position = Byte offset * 8 - diff
@DaveRandom Hey, once it's in PHP it's native dude
That's the whole point of an abstraction. You don't wanna have to think about it.
@BrentRoose A separate mapping from whatever you want to bit index.
14:40
You just wanna do $num >> $whatevs
the tl;dr of all this @BrentRoose is that there are a few considerations here, there's no universal one-size-fits-all right answer... it depends what you are trying to accomplish with it
@BrentRoose For example: gist.github.com/srgoogleguy/…
So if you have a use case where you need to store a set of values from a (reasonably small) finite universe many, many times, you'll have one hashtable from your universe to bit indexes, and then can use the much more compact bit vector representation for the individual sets
in particular, integers are best if you need interop with other arbitrary systems
That maps the bit field to the byte offset and then ORs the bit.
14:42
although even then you need to consider endianness
Very interesting, you're all programming on another level than I am :D
But I get the gist, thanks for explaining all of this
Did you hear that. I'm on another level!
@BrentRoose you might be interested in playing with C a bit, once you get your head around it they go somewhat hand in hand, in general there's not much to be gained from farting about with sub-byte level things in high level programming languages
although at the same time I apologise in advance
:-P
@DaveRandom You are a horrible person
though honestly, you don't need to touch that low level of zvals at all and still can be productive with it :)
14:47
tbf it is interesting, in a masochistic sort of way
Telling people to use C should be a crime punishable by public flogging.
@DaveRandom did you know... big-endians break their boiled eggs at the larger end? TIL
ooffffff
I've got a big endian
ah there we go, back to #friday
:-P wat, I can now totally remember endianness. Apparently it's a thing in Gulliver's Travels...
14:49
@DaveRandom show off
@Ekin ummmm... wat?
huh, TIL
Why can't people just stick to LSB and MSB?
14:50
All things should be right-to-left in computer science
I think I've brought this up before, but I've always wondered whether little-endian architectures represent bytes with the bits in reverse order in the registers
if not, seems like an odd design choice
It's because Windows did everything backwards from Linux
That's where the uproar began
s/Linux/*nix
Or was it IBM that started this mess?
@DaveRandom What's the order in registers supposed to be?
Do you mean the physical transistor layout?
That's taking it a bit too far.
...that's where I run out of confidence in talking about it, but presumably yes
14:57
If we're going to start arranging transistors based on endeaness... well... I quit!
I've also wondered what the use of the high/low nibble options of pack() hex strings is
clearly something has a concept of sub-byte endianness, or they wouldn't exist
@DaveRandom Some networks read the bytes backwards
It's retarded, but it exists
I've seen Cisco routers that actually rearrange packets according to local network endeaness specific rules
...and that demonstrates the sort of thing that's made me idly wonder about this stuff :-P
it doesn't matter in any meaningful sense of my life, obviously
All things should be little-endian <period>
It's the only thing that makes sense damn it
it's (slightly) harder to think about intuitively though, we write decimals with arabic numerals as big endian
15:02
You're right ... but many humans think big endian is the one true endian. But we machines understand.
imagine if that ends up being the fundamental issue which starts the war which brings about the end of civilisation
I'm guessing the real war will be over something far stupider
yeh, like food and water or some shit
idiots
tabs vs spaces
> But we machines understand

It's confirmed, Nikita is a robot
4
15:04
EVERYONE knows it's spaces!
Nikibot 385378
If @NikiC is a bot, does he have a hard-coded admin/admin password?
'cause all IoT have one of those, right?
Or does he come with a TPM?
@NikiC you know the weird thing I just realized about strlen from your comment earlier; it's not really a function at all. It behaves more like an OPCODE than a function. Perhaps you have a good point here.
I'm going to revert my commit.
just revert the whole internet and be done with it
@DaveRandom gulp
I can't break the Internet!
git reset --hard HEAD~60years && git clean -f
15:16
That's extreme.
yeh, but have you seen Twitter? I really think it's for the best
We should definitely revert twitter
that one makes sense
And reddit while we're at it
probably @Jimbo as well
for good measure
where is Wesley btw @PeeHaa?
I need someone to nerd off over Star Trek with
How do you feel about Picard?
it starts so slooooow
good things come to those who wait
15:28
yeah but 2 episodes in just put the man on a ship ffs
it's taken 25 years, you can wait 2 weeks :-P
I'd like to see you find an interstellar vehicle someone will let you command with a 2 week lead time
@DaveRandom I hear Musk is working on one of those
It has autopilot
Self driving spaceships are the new thing
it follows the recent star trek tendency towards long-form stories rather than strictly episodic things, atm I have confidence it will be worth it
@Sherif I really hope it has assisted parking more than anything
don't fancy trying to reverse the Enterprise into a narrow parking orbit
15:32
@DaveRandom Yea, but it's only Level 2
What's your favorite Star Trek btw ?
way too hard :-P
if you put a gun to my head, TNG
Yeah, TNG would be my choice as well. the only one I couldn't really get into was TOS
never really got into ENT
TOS stands alone really, it is good in it's own way but very different to everything that came after
I mean, it's <=50% objectively good, like everything else in star trek :-P
the first 1.5 seasons of TNG... :-P
VOY has some really really really terrible bits as well
DS9 is probably the most consistent
15:52
@DaveRandom you mean like building the entire series on the cliche that women cant drive?
Tom Paris is also one of the most hateable characters in television history
Does anyone have suggestions for an online PHP logging site I can send debug data to? Like NewRelic but not total platform monitoring. I just want to push some log data when PHP exceptions happen and see them online
I could code a DB myself etc but there must be a basic one (free ideally but happy to pay if free means rubbish)
@James You mean like logstash?
^ that
is it now called "Papertrail"?
15:58
although it self-host only afaik (but not particularly resource hungry)
That's the commercial service. Logstash is open source.
ok having a look - thanks :)
16:12
Any classes in core that use typed properties? Do we have an API for it?
01:00 - 17:0017:00 - 00:00

« first day (3401 days earlier)      last day (1771 days later) »