2022/11/01: Difference between revisions
(Created page with "{{page/date}} ==PHP namespace issue== So, this is just kind of weird. I don't know yet if it's a bug or just something I've overlooked. Code: <syntaxhighlight lang=php> <?php...") |
No edit summary |
||
Line 18: | Line 18: | ||
The major clue, I think, is that if I replace all the "FD" aliases with "\ferret\data", I get the ''exact same error'' -- which suggests that the problem is actually in some other file. | The major clue, I think, is that if I replace all the "FD" aliases with "\ferret\data", I get the ''exact same error'' -- which suggests that the problem is actually in some other file. | ||
...yep, that's what it was! | |||
==Data-Mangling Syntax== | |||
How about something like... | |||
{{arg|array_var}}({{arg|var_for_key}},{{arg|var_for_val}}){ ...code... } | |||
That means "for each element in {{arg|array_var}}, assign the element's name to the variable {{arg|var_for_key}} and value to {{arg|var_for_val}} and then execute the code in the curly braces". | |||
Why not just <syntaxhighlight lang=php inline>foreach ($array_var as $key => $val) { ...code>... }</syntaxhighlight, as in PHP? I don't know, except that seems more complicated and less succinct. I want to keep the syntax (and parser code) simple. |
Revision as of 13:35, 1 November 2022
Tuesday, November 1, 2022 (#305)
|
PHP namespace issueSo, this is just kind of weird. I don't know yet if it's a bug or just something I've overlooked. Code: <?php namespace greenmine\config;
use ferret\data as FD;
class cServerSpec extends FD\cDBServerSpec {}
class csDataSpec extends FD\csSpecs {
static protected function GetSpec(string $sKey) : cServerSpec {
Error: "Class ferret\data\FD\cDBServerSpec was requested but is neither loaded nor registered with the Class Loader." The major clue, I think, is that if I replace all the "FD" aliases with "\ferret\data", I get the exact same error -- which suggests that the problem is actually in some other file. ...yep, that's what it was! Data-Mangling SyntaxHow about something like... <array_var>(<var_for_key>,<var_for_val>){ ...code... } That means "for each element in <array_var>, assign the element's name to the variable <var_for_key> and value to <var_for_val> and then execute the code in the curly braces". Why not just <syntaxhighlight lang=php inline>foreach ($array_var as $key => $val) { ...code>... }</syntaxhighlight, as in PHP? I don't know, except that seems more complicated and less succinct. I want to keep the syntax (and parser code) simple. |