Skip to content

Improvement of chapter "Výrazové prostředky" - updated version#1065

Closed
mildabre wants to merge 150 commits into
nette:masterfrom
mildabre:patch-22
Closed

Improvement of chapter "Výrazové prostředky" - updated version#1065
mildabre wants to merge 150 commits into
nette:masterfrom
mildabre:patch-22

Conversation

@mildabre

@mildabre mildabre commented Nov 4, 2024

Copy link
Copy Markdown
Contributor

The term 'výrazové prostředky' is correct, but common developer understands the word "syntaktické prvky" better. I also suggest reordering the items + complete missing description about public properties and explicite note the slight syntax difference between constant and property.

I was very confused by that fact, that approx. 3 years ago the syntax for public properties @myservice::publicProperty was not supported and the only supported syntax at that time was funny: @myservice::$publicProperty() so I have it in my services.neon. Another source of confusion is neon plugin of @mesour which suggests public properties with $ on the beginning.

When I tested yesterday the syntax @myservice::publicProperty I made first letter uppercase @myservice::PublicProperty and got exception that constant not exist. I see that the difference in syntax between constant and property is very slight - first letter uppercase/lowercase. I think its goodidea, but I see important point out this slight difference in documentation as well.

The syntax of public properties is also discussed here on forum: https://forum.nette.org/cs/36714-rfc-upravit-matouci-syntaxi-public-property-sluzby-v-services-neon

@dg dg force-pushed the master branch 29 times, most recently from e0bc7f4 to 3c92c82 Compare December 18, 2024 14:49
@dg

dg commented Jul 5, 2026

Copy link
Copy Markdown
Member

Thanks — there's a genuinely valuable, non-obvious point buried in here, and I've documented it (622dbe5ce, both languages).

Incorporated: the property-vs-constant distinction. I verified it in the DI source (Resolver::convertReferences()): for @service::member, a name matching ^[A-Z]… is resolved as a class constant, otherwise as a public property ('$' . name). So the first-letter case really does decide it — good catch, this wasn't documented. I added a short paragraph plus an example showing @configProvider::apiUrl (property) vs @configProvider::Version (constant), placed right after the constants block.

Not taken, and why:

  • The heading rename Výrazové prostředky → Syntaktické prvky: it's an established term, renaming changes the anchor (linked from 3 places) and diverges from the English "Expression means"; I'd rather not rebrand it unilaterally.
  • FilesystemIterator::SKIP_DOTS → SkipDots: SKIP_DOTS is the real PHP constant (and already starts uppercase), so I kept it — SkipDots doesn't exist and would be a factual error.
  • The larger reordering: the current ordering reads fine, so I kept it to minimize churn.

Closing since the branch can't be merged directly. Really appreciate you flagging the confusing property/constant syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.