I’ve been learning a bit about Haskell recently and it has me pining for lazy evaluation in PHP without all the effort of doing it manually. As I envision it lazy evaluation in PHP would allow annotating a class property or even a variable with a typehint-like keyword lazy and then when that property or …
Using Reflection in Go to assign a Value to a Property of a Struct Contained in a Map
This solution had me literally working on-again off-again for a full week. One of the main reasons it took so long was I was trying to write a wrapper to simplify because I find the reflect package in Go so unintuitive and hard-to-work-with. But it turns out that trying to write a wrapper around an …
Continue reading “Using Reflection in Go to assign a Value to a Property of a Struct Contained in a Map”
Adding Delegation to PHP
In summary I am proposing the PHP leverage the
use statement like the PHP
trait does, but with a
class modifier to allow for automatic delegation of method calls to contained instances.
Also I am proposing we leverage the disambiguation syntax that is already available for traits, and extend it in a few ways that traits do not address such as:
asto allow for renaming from the property names for delegate classes,
excludeto allow including or excluding specific methods, and
use methodto allow for including specific methods.
WordPress should deprecate themes — a modest proposal
“Imagine if — starting with version 6.0 maybe — the WordPress team chose to actually deprecate themes, and then added modules and components as first-class extensions instead? “
PHP’s Composer is the worst tool, but it is the best we’ve got
“Democracy is the worst form of government except for all those other forms that have been tried.” Winston Churchill, plagiarized Composer for PHP is much like democracy, except for there are no others. So I have always hated Composer, for many reasons. And my views on Composer are admittedly in stark contrast with many others …
Continue reading “PHP’s Composer is the worst tool, but it is the best we’ve got”
Can your coding standards do this?
I am not a researcher so I don’t have the statistics to back up my assertions for the post, but I have mostly written programs for a living for over 25 years — in my opinion — there is one hugely important aspect of coding standards rarely discussed and that is: reproducability. “Reproducability” defined What …
A better alternative to “return early” – PHP / WordPress edition
Yes, complex conditionals are worse. But there is a third, better way. And no, it does not involve GOTOs. Me This post is about a coding pattern I have never seen used by anyone else for writing guard clauses, especially when those guard clauses are complex. This pattern results in code that is significantly more …
Continue reading “A better alternative to “return early” – PHP / WordPress edition”
Pros and cons of leveraging Go types
UPDATE: Since writing these over 3 years ago I have since learned a lot more about GoLang and its type system. Ironically, I now realize that GoLang has type aliases that are effectively what I was lobbying for. ORIGINAL POST: Go is a great language — probably one of the best — but it is …
The drawbacks of D.R.Y.
D.R.Y., or “Don’t Repeat Yourself” has become a mantra for developers in recent years to the level of becoming dogma. Unfortunately, as with most dogma, it is often viewed more of an absolute rule and less of a general guideline that often should be ignored. The opposite of D.R.Y. Since we have this nice cheesy …
On Typing Strings in Go
UPDATE: Since writing these over 3 years ago I have since learned a lot more about GoLang and its type system. As such I now realize that GoLang has type aliases to address the need that I was writing an experience report about. ORIGINAL POST: One of the niftier aspects of programming in Go is …