Stuff after a ::Resource clause, but in the same line, is ignored. Namely, in
::Resource test; ignored
line1
line2
::END
"ignored" could be a) considered to be part of the resource, i.e., its first line (it is not), or b) ignored (it is).
Both semantics are clearly acceptable. The current behaviour should be reflected in the documentation.
Anonymous
I feel this is a bug; i.e. the ';' terminates the clause so the 'ignored' should be part of the resource. Other directives work this way, consider the following syntactically correct code fragment:
::class dummy public; ::method gil; return yikes!
::method foo; ::method bar
::attribute one; ::attribute two
Last edit: Gil Barmwater 2024-08-03
Yes, but resources are a little special. Normal tokenizing is interrupted until the ::END delimiter is found -- and the ::END line itself ignores everything after the ::END.
Another reason to defend the idea that everything after the semicolon should be ignored is that, this way, the resource data can always be identified as a section of the source array. Otherwise, you need a (line, col) pair at the beginning.
Anyway, I am not advocating for either solution. Maybe the language designers should step in and explain what was the design idea...