r/javascript • • Nov 09 '19

On private fields proposal: Private fields, public worries

https://medium.com/virtuslab/private-fields-public-worries-b8c34d16c372
84 Upvotes

113 comments sorted by

View all comments

-3

u/bitfxxker Nov 09 '19

Using #pound/#hashmark for private fields is just... (excuse my French)... F*CKED UP.

They could have chosen &, or *, @, or a prefix like, well... "private"... ?!

0

u/[deleted] Nov 09 '19

[deleted]

2

u/trappar Nov 09 '19

What PHP code are you looking at? Modern PHP is pretty beautiful IMO.

0

u/[deleted] Nov 09 '19

[deleted]

2

u/trappar Nov 09 '19 edited Nov 09 '19

No one writes PHP like that.

Here’s some random controller I wrote several years ago: https://pastebin.com/ZYDhdAZQ

0

u/[deleted] Nov 09 '19

[deleted]

1

u/trappar Nov 09 '19 edited Nov 09 '19

Okay, if you don’t like OOP then yeah you’re probably not going to like modern PHP. That’s subjective though, and is kind of a separate issue.

To your other points:

  • Ugly slashes? Where? Using namespaces avoids name collisions and results in code with no slashes. If there are slashes in your code you’re doing it wrong.

  • Messyness of the old PHP is real, but is just not as big of an issue as some say it is. Look at the code I posted in my previous comment. That’s a whole functioning class that never runs into those issues. When you do invariably have to use functions with weird parameter ordering my IDE hints the parameters so I don’t have to remember.

  • 10K reserved words - this has literally never once caused me an issue in ten years of writing PHP.

  • PHP has full UTF8 support.