Re: [RFC] Shorter attribute syntax

From: Date: Mon, 08 Jun 2020 18:08:06 +0000
Subject: Re: [RFC] Shorter attribute syntax
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-110432@lists.php.net to get a copy of this message
Hi Theodore, On 08.06.20 06:36, Theodore Brown wrote:
// 170 characters for attributes (162 not counting leading whitespace)
<<
   ManyToMany(Phonenumber::class),
   JoinTable("users_phonenumbers"),
   JoinColumn("user_id", "id"),
   InverseJoinColumn("phonenumber_id", "id", JoinColumn::UNIQUE),
private $phonenumbers; // 160 characters for attributes @@ManyToMany(Phonenumber::class) @@JoinTable("users_phonenumbers") @@JoinColumn("user_id", "id") @@InverseJoinColumn("phonenumber_id", "id", JoinColumn::UNIQUE) private $phonenumbers;
When your proposal came up, my first thought was this is great and should be supported; I simply had a liking for this terse syntax over the older. Until I read your email last night and saw some direct text comparison. I noticed that my @ character did bleed/meld almost with the first character of the attribute name. I noticed this in my MUA so I figured a proper test in the IDE with my font of choice is more realistic; here's a plainly colored version first: https://i.imgur.com/tq7FzQz.png Notice how wide characters like the M almost touch the @. Same now in a best attempt PHP syntax highlighted source file (courtesy of PhpStorm, obviously not supporting this ATM): https://i.imgur.com/WVXL8S7.png But even a clearly distinct colored @@ token did, for me personally, not increase the readability by much ("to me"). At this point I forgot if the following is a valid combination, but it wouldn't matter as I want to make comparison data point for my personally and even this version is by far more readable, to me at least: https://i.imgur.com/GI3HlsM.png Until I had this realization, I was absolutely in favour of @@. I'm not so much anymore. Since we humans read source more often then we write, I can only suggest to everyone to conduct their own "visual" testing first and not just judge on technical merits => I think it makes sense to consider both here, since we're already discussing a change here. (note: I'm not a voter here) I wonder what others think about this. thanks, - Markus

« previous php.internals (#110432) next »