« first day (2904 days earlier)      last day (2269 days later) » 
00:00 - 16:0016:00 - 00:00

16:00
floats with a low integer value typically have an exponent of zero, which is exact expression of the value?
@bwoebi In that case why wouldn't it be okay to express dollar amounts as floats?
@Alesana it actually would, as long as you express cent amounts as floats
Meh. Maybe I just need to do more research before I ask more questions about it.
at which point you can just use integers as well
@bwoebi What do you mean by that? What else would you express as floats when referring to currency? (Other than pence, of course :P)
16:05
@Alesana the problem is that decimals cannot be expressed as precise floats
if we had bcd encoded floats, it would be perfectly fine to use floats for currency
@bwoebi Why?
Ah, okay. So I think that Allenph's question was regarding floats with insignificant amounts of decimals
@bwoebi ask @LeviMorrison, he's the one advocating for that
@Alesana Yep.
from my perspective the advantage would be that you can decouple the declaration of getters/setter and the underlying property (of potentially the same name)
which is basically what you are also talking about, but more explicit
The disadvantage of having that be implicit is that either you do not reserve a slot for the backing property where it would be necessary, or reserve one where it's not necessary
16:10
@NikiC Why exactly is that an advantage, except that it makes harder to spot whether a property has getters/setters?
Though it might be better to handle the lazy initialization case with a separate lazy accessor. Which is both more ergonomic and allows us to special case it. e.g. unset should only be allowed if it's used
@Allenph I've always wondered that too - although I suppose it would have to be a different type altogether. I think it would be convenient to have an exact decimal type that has a limit on complexity (maybe that's what a bcd encoded float would be?)
@Alesana Yeah. Exactly.
What is the correct way of implementing json support in an extension, not know whether the json ext is loaded? Facing the same issue now that php-ds still has - json must be loaded before the extension otherwise it can't find the ce.
@NikiC I'm not sure whether that's actually more ergonomic or more confusing...
16:12
@bwoebi one thing I dislike about the c# syntax is how it deals with asymmetric visibility
@rtheunissen you can require it in the build
@NikiC I.e.?
there's a dependency system iirc
@bwoebi how is a built-in language feature for lazily initialized properties more confusing than hacking it with accessors that get ignored after the first call due to very specific things in php's treatment of properties?
@bwoebi public $foo { get; private set; } and similar. is just weird
@NikiC I meant, what is the behavior which you find weird?
16:14
@bwoebi not the behavior, the syntax
ah okay
the fact that both the property and the accessors have separate visibility
with the property visibility just being a default
Got it
var $foo { public get; private set; } would really make more sense...
@NikiC Because we then need also a way to invalidate a cached value
16:16
guys, btw, if I'm adding a bool to zend_arg_info, should I just add one more prop a la is_variadic or should I try to encode it in Dmitry's zend_type?
@bwoebi which unset would still do, I assume
I don't really like hiding it behind a "lazy" magic
I'll try PHP_ADD_EXTENSION_DEP
@pmmaga don't touch zend_type before the typed properties are merged, really
on top of your branch already :P
16:17
lazy might be a bad term in that context. "memoized" would be more accurate there
@pmmaga That depends on whether it's part of the type or not
@NikiC Not discussing the name here, I find it still quite magical
so, my (probably hacky) idea is to keep the type info "untouched" but add a flag that it is an array of that type
It'd be more obvious to me if I were to explicitly see "value gets assigned to property"
I think PHP_ADD_EXTENSION_DEP is only used when building into php statically
So as an external dependency, there's no guarantee that json is available at build time
I'm also wondering what is the limit of how much you can pad a pointer :x
@pmmaga ah no, that should be part of zend_type
@pmmaga Technically 2 bits, practically 3 bits
I have a procedural function library, several functions have global variables defined in them. I want to fix that, what is the best way to go about that? Defining setters and getters doesn't seem the right way to go about it. Maybe a "main" function (or constructor, but I don't think procedural code has constructors) that instantiates these variables and returns them? But that doesn't feel right either...
so, it would be reasonable to pad one more bit for this?
As the allocators will give you at least 8-byte aligned memory and IIRC compilers do not align rodata structures on 4-byte boundaries unless you explicitly tell them so.
16:25
Looks like a system thing, rather than a config/build problem.
@pmmaga I think it would be safe, but I wouldn't do
@NikiC Definitely agree - very weird.
interesting blog post/tutorial post for refactoring untestable PHP code... on IBM's site of all things ... ibm.com/developerworks/library/os-refactoringphp/index.html
16:36
@Danack "Not Found" is that what you're receiving?
Borken. 404
would a simpler way to refactor out global variables from a procedural library is to refactor the library into classes?
@Tiffany That would end up being a singleton, wouldn't it?
@Allenph probably... but this script will be coupled to an Oracle database because the ERP system is coupled to Oracle
I don't get why that's relevant.
16:40
it is a quick-and-dirty, get-it-done type script, it serves to take placement test scores and feed them into our ERP system
@pmmaga I'd rather create an extra structure which has also a char as first element of the structure and then disambiguate between class and array of zend_type by that first char
If there's reusable functionality pertaining to those global variables a singleton might be an improvement, but if not I would just leave it rather that adding additional complexity to the problem of having globals.
@Allenph my goal is to be able to write tests for some of the functions to make sure it's working, so that I don't have to rely on someone else sending me a sample CSV file
(mind you, this is also the first time I'm writing tests, so doing it this way is also a learning experience for me)
One thing you could do is write the class correctly then just dump the only instance of it into a global variable.
That way it's easier to test, it's written correctly, and you don't have to change your entire script.
it's procedural soup currently
16:45
@pmmaga at least once we introduce unions/intersections we anyway need an extra structure for that
@Tiffany I'd say that last option is the best one.
Then you actually fixed something instead of just creating a different problem.
@bwoebi if I were to do that, should I also move the allow_null and ce/class flags to that char? or leave them as they are?
@pmmaga leave them where they are
I don't like the idea of making it a singleton/god object, but because this script serves a very specific purpose, I don't really see the point of abstracting it
as basic types and zend_string* class names obviously don't have a leading char (and we do not want extra allocations for these simple cases)
16:48
There's never a good reason to make a singleton. You're doing the same amount of work but getting none of the benefits.
true...
If you ever want to improve the script later (which you're doing right now so I assume it's possible) it would be better for you to come back to a single instance of a correctly written class dumped in a global var than a singleton.
If you go the singleton route there's a really good chance you're going to end up changing how everything works when you refactor instead of just changing how the class works.
@bwoebi makes sense, thanks
I guess I'm not following what you mean by a "single instance dumped into a global variable"
@bwoebi I don't understand that
16:50
do you mean the script that I use to call this stuff will create a single object and then do whatever with it from there?
Are you saying to grow the size of zend_type (effectively)?
global $Var = 27;
global $var1 = 943;

Replace with...

global $var = new SomeClass(27, 943);
@Allenph these are mutable global variables >.<
So? Properties of classes can be made mutable too.
e.g. global $error, $e, $logfile; as the first line in multiple functions
16:52
@NikiC the first element of _zend_class_entry {} is a char whose values are either ZEND_USER_CLASS (2) or ZEND_INTERNAL_CLASS (1). Now we can create a struct _zend_array_type { char; zend_type type; } with the first char being always 3
@Tiffany Write a class to represent those things, with methods that express the common functionality you see in the procedures.
I'll give it a shot
@bwoebi ahh, now I get it. that makes sense
Then just strap them to the same global variables.
Am I making sense or not really?
@Allenph you are
my hesitation is that you're suggesting to continue to use global variables. Why?
16:54
@bwoebi aha! Now I know where to get "inspiration" :P
I know they're shifted elsewhere within the program so they're easier to keep corralled
Because if you use a singleton you're still using global variables just in a more complicated way and a way that will end in bad code wherever the class is used.
Bad code that will have to change if there's a refactor.
sorry, I shouldn't have said singleton, it wasn't what I meant :X in my head, I figured this would become a god object, and I thought that would be synonymous with singleton
you've given me some ideas to work from though, I'll try it out, thank you
To avoid using globals you're probably going to have to change the procedure before you can really solve the problem.
17:14
@Allenph that's not how you migrate to a better code
Wes
Wes
@Allenph no
code should not look for collaborators itself (especially if they are global), code should be handed collaborators
occasionally I have to modify the script, but it's very much a one-off type deal that I have no intentions at this moment to reuse elsewhere.
The function library that I'm working with was shared with us from an employee of another college/university to help us out
@Tiffany are you writing tests in php or should we treat it as language-agnostic thing
@tereško php, and I will probably use phpunit
for various import/cron scripts you can't really write tests
17:24
:(
I was planning to write an integration test once I figured it out (played around with the code enough)
if you have a lot of those, I would suggest adding some monitoring instead
buuuut
this is one of the posts I was reading phpunit.de/manual/6.5/en/database.html
you can test parts of your scripts, if your import scripts are using some sort of services
@tereško they use the OCI extension
heh - for DB testing I have a simple solution: SQLite
17:27
right now, our setup is basically testing in production... by flipping a switch to turn on the placement testing system we're switching to, and an employee doing the placement test, then a scheduled task downloads the scores, php script takes the values from the CSV file, does some stuff to make the data work in our ERP, then inserts it into the database
I'm trying to improve that...
how much have you worked with phpunit before?
@tereško zero :/
do you have any parts of the codebase, that are, what one would call "good classes"?
it's procedural soup
17:30
a 1000 line function library
ok ... emmm ... hmm ... faking it then
how many of the functions are "leaf functions" ?
you can use phpunit to test those (as long as they don't touch DB)
er, I'd have to check
You guys legitimately thought I was telling her to sprinkle globals all over for no reason?
I think there's a decent amount of them
@Allenph <3
those "leaf functions" are something that you can actually test in a semi-sane manner
if you build a good coverage for them, then you will be able to start testing the "functions that only use leaf functions"
.... as long as there are no globals in any of them
17:35
approximately nine leaf functions?
out of thousands ?
jeez
there are globals in almost all of these functions...
well, you can isolate globals
Just move them into the argument list.
17:36
What else can you do?
If she moves them into the arguments of the function she can start having isolated function which will eventually lead to the ability to remove the globals all together.
I was thinking of getters/setters but that doesn't seem like the right way to do it
plus that would lead to a whole other mess
Global getters and setters might as well be a singleton with static getters and setters.
17:51
Sorry, pastebin blocked. @Tiffany
here, I'll copy and paste it into editor if you want to delete it
Then from there you could choose to bring all those functions together into objects, or just stick with a structs and functions type deal. Either way testable, clean. Etc.
thanks
it's lunchtime but I don't want to go to lunch... not hungry... but I need to...
 
1 hour later…
19:23
sweet mother of mercy
. str_replace("'","",$accuplacer_assoc[$row]['Last Name']) . "', '" . str_replace("'","",$accuplacer_assoc[$row]['First Name']) . "', '" . str_replace("'","",$accuplacer_assoc[$row]['Middle Initial']) . "', '"
. $accuplacer_assoc[$row]['Student ID'] . "', '" . $accuplacer_assoc[$row]['Birth Date'] . "', '" . $accuplacer_assoc[$row]['Test Start']. "', '"
lol
I will assume that this doesn't even come with a vague comment
Wes
Wes
i wish i know why phpstorm does
- autocomplete "new " to abstract classes
- not mark new AbstractClass() as error
@Tiffany but who does this
@tereško this is somewhere above it //if the update did not affect any rows, insert a new record into the archive
I hope they pay well
if they do, then just keep on working in the spaghetti mines
you will want a clear near-term goal in your refactoring
soemthing that you estimate as a possible thing in 2 months
that way you will be able to see (and even show) progress, even though it will still feel like banging your head against the great wall of china
also, I hope you already have GIT there
I don't have two months.... more like two weeks, the fucking testing company is ending support for a testing platform and switching to a new one. They announced it early this year, but didn't provide any information about what would it would entail until like July-ish. Internal discussions for what they wanted to do for another couple of months, and finally was given half of the specs.
and I do have git
19:33
@NikiC statics on traits are anyway a weird thing... Nice find
@Tiffany I will assume that you already have communicated to your management that this is bullshit, and if you make anything practical in this situation, it should be regarded as a miracle (and compensated accordingly)
anyway, nn
I am falling asleep on the keyboard
@bwoebi Statics on traits by itself are fine, but the fact that you can access them through the trait is weird
@NikiC That's what I'm referring to, yeah
are we in a position to just prohibit this?
@NikiC Especially as they aren't shared between the classes which use the trait
Wes
Wes
19:46
no
why no?
Wes
Wes
there was an article somewhere that was like this "simulate static classes in php using traits"
:B
wat
waaat
waaaaat
god I hate users
11
users are the worst
8
Wes
Wes
ha
lol
Wes
Wes
19:49
are you guys working on deprecations?
@Wes typed props
Wes
Wes
i wouldn't care about traits though... if people shoot themselves in the foot it's their problem
That's not how this works :-P
Wes
Wes
i doubt php.net explicitly mentions that as a feature
@bwoebi an attempt :D
Wes
Wes
19:55
might be the right time to learn cs-fixer and stuff
@pmmaga Good luck.
I'll need it :P
I'll need to do something similar for generics at some point.
Tomorrow I will be working on implementing the first few cases of covariant return types.
Ones where all the relevant type info is stored in the inheritance tree.
@LeviMorrison some time ago I did a very basic prototype just to try it out. May be useful
@Tiffany Is this some McDonalds robot that we can purchase from? Haha
> sunhme.c: Sparc HME/BigMac 10/100baseT half/full duplex auto switching, auto carrier detecting ethernet driver. Also known as the "Happy Meal Ethernet" found on SunSwift SBUS cards.
@pmmaga this leaks memory :-P but yeah, something along these lines
@pmmaga see the url ;-)
@FlorianMargaine :D so, if you search for a commit upstream it also finds it on forks?
20:39
@pmmaga github uses the same repository for upstream + all the forks, just the refs change
@bwoebi :D
so if you fork, then make a new commit in your fork, the commit hash will be available in the upstream repo URL too
yeah, that makes sense
@FlorianMargaine but sadly it fails to display the originating branch under the commit message
@Tiffany I guess I could have read that :P
20:53
@bwoebi yeah the refs are per-repo
21:05
@NikiC The fix for the traits should be simple - just throwing directly in zend_load_property_class_type() and returning null if info->ce is a trait inside the self resolution branch, right?
@tereško the idea is that I'm not supposed to be doing this extra work that I am, but since I'm waiting on the rest of the specifications to continue doing it messily, might as well try to clean it up, if I'm able to
@bwoebi sounds reasonable-ish
@bwoebi why the second part though?
ah wait, we duplicate the property_info when it's imported from a trait, right?
@NikiC IIRC, yes
Wes
Wes
Referenced sniff "SlevomatCodingStandard...." does not exist any idea what could cause this, given that i have installed slevomat?
@NikiC The only drawback obviously is … trait Foo { public static ?self $prop; } Foo::$prop = null; will also fail then...
Nah it won't
21:15
@bwoebi ah
hrm
nullability is checked first
but maybe it should fail... ^^
and returns early
so it just works out
@NikiC dunno, the way it currently is, you can initialize a trait static before it gets used
as useing them will copy the values as well
it just gets interesting once we have unions ...
or arrays of type
as array of self obviously would allow an empty array
yesterday, by Dan Lugg
I hate naming things
I can't think of a name for this class
@bwoebi maybe something to add to the deprecations rfc?
if we can't drop this immediately we might at least be able to drop it later, before it becomes more of an issue
21:20
I'm not sure.
because self is really not well-defined when directly using traits
I don't think this feature is inherently bad
@NikiC self should just be undefined
...great, my old patch for detecting invalid "parent" usage doesn't work in all cases any more.
just like a type we don't know yet
Oh, if you are talking about "self" that's related to what I'm working on.
21:21
@NikiC with unions we anyway need partially resolved types
@bwoebi do we?
@NikiC I think so. There's no need to load A for an union A|B if assigned B
I'm not sure that's something we want. It might make more sense to eagerly evaluate types
It's not warning here:
interface B {
	function m(): parent;
}
21:24
@NikiC What's the advantage?
@bwoebi piece of mind :P
At least I'm not fond of triggering autoloads within typechecks
In particular...
You may reference an optional dependency in your union type @NikiC ... And expect nothing to explode if it isn't available
@bwoebi And that's where the piece of mind is gone...
:-P
If you want to give that as a guarantee rather than an optimization, then we're going to get issues for things like lsp checks
Because assuming we get those properly variant types, we might have to load the class there to check variance (of the union type components)
21:29
ugh
> Argument 1 passed to foo() must be an instance of �_Kc�U, array given,
It's one thing if we don't load as an optimization, it's different if we guarantee not loading
What leaks?
I don't think we can reasonably give that guarantee
@pmmaga It looks like bits of the void are leaking
:P I haven't started the checks yet but found that message funny
21:36
@NikiC I'm not sure. We have the choice between delaying the LSP check until the to class referenced within the union is loaded (add to a hashtable and trigger on class load) or requiring it immediately
The only thing where we pretty much have to load for LSP checking is contravariance in arguments
hmmm
@NikiC Well, we can attempt to load and just simply not fail if the class does not exist yet, but the types are nevertheless matching given the available information
Oh, my patch is catching it -- I just didn't have E_DEPRECATED enabled I guess.
Now I need to see if anonymous classes goof it up.
Nope, all good.
PR opened. Reviews would be great.
/cc @bwoebi @NikiC
I need to add a test case still for anonymous classes not goofing it up, but I've informally tested it at this point.
Wes
Wes
22:11
@bwoebi is this important, given opcache?
<!-- Require closures not referencing $this be static -->
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
targeting 7.2
Oh please don't let anyone know about static closures if they don't already know.
Wes
Wes
why?
22:31
Is it possible to make a "group" of form fields readonly all at once using an if statement instead of individually making each field readonly?
Old habit.. I use <?php echo instead of <?= , is it normal to use <?= in production now-a-days?
@benlevywebdesign use fieldsets readonly, not disabled
@Wes wat. You make your Closures static to solve an issue
You do not make them static because you can
Wes
Wes
what issue for example?
i thought it was mostly for speed, like
foreach($amillion as $bla){
   $one = static function(){};
}
@Wes that's micro-optimization really
@Wes circular references
Wes
Wes
22:39
i see
@pmmaga I know how to do individual fields as readonly
@Darius yes, definitely
Wes
Wes
i use <? if(){ ?> also [change-my-mind.jpg]
@LeviMorrison looks good in general, please add one more test with traits (should be fine though through usage of zend_is_scope_known())
@Wes I see no reason to change your mind
perhaps use <?php instead of <?, but that is it
Is it just me or is it more complicated to do Jenkins than it is to write a bash script?
Wes
Wes
@bwoebi is what i am saying, i use <? because <?php is too long
@Wes IDGAF - I just don't want to be dependent on that ini setting :-D
Wes
Wes
:D
Wes
Wes
\o
 189 | ERROR | [ ] Method
     |       |     \...::.......()
     |       |     does not have return type hint nor @return
     |       |     annotation for its return value.
but it does
22:48
@Wes detected: usage of static analysis. Proposed action: Avoid static analysis.
Wes
Wes
:B
it's not static analysis, want to fix code style because @PeeHaa complained about it
i am not like you guys
if ( $aaaa === ! $bbbb && (int) $ccc ) {
space after ! and cast. beautiful :B
@Wes duh ... I like spaces after a cast
But not after !
Wes
Wes
horrible :B
no, seriously, it's subjective, but every single time i get told that my code style sucks
it's like that's the only thing that matters :B
@Wes let's call it .... having potential for improvement
Wes
Wes
22:55
@Tpojka :B
phpcs doesn't follow its own phpcs coding standards :B
Actually, anyone is welcome to take a look and let me know what you don't like. :p
https://github.com/php-decimal/php-decimal
23:11
@rtheunissen what's the precision?
Whatever you want it to be
oh, it's an ini setting
I was looking for something on the Decimal class
It's shared.
yeah, realized that
Wouldn't be too difficult to embed a context on the object though.
Was a lot easier to implement with a shared context.
23:15
Can't tell if it's necessary or not as I have no concrete use cases for this
Pretty much everything I need can be easily done wit gmp and an exponent
I work at a company that build financial tools for agriculture, and we have struggled with rounding precision. We inflate by 10,000 and deflate on output. It's such a hassle though and often causes bugs that are difficult to trace. We built a calculator based on bcmath which has improved things but is still not friendly to use, with a lot of little internal hacks.

This lib is also about 2x as fast as bcmath.

Haven't tested against gmp yet.
I don't think it's as simple as "gmp with an exponent"
Wes
Wes
@rtheunissen can we haz this too? github.com/douglascrockford/DEC64
it's float but base 10
@Wes it's no good.
I emailed him to discuss dec64 vs mpdecimal
Decided to go with what python uses, also something that implements a standard
Wes
Wes
well, same thing, no?
dec64 is cool but is not the same thing at all.
Wes
Wes
23:28
mpdecimal is arbitrary precision?
like python 3's?
Yup, so this uses the same internals
Wes
Wes
cool
00:00 - 16:0016:00 - 00:00

« first day (2904 days earlier)      last day (2269 days later) »