language design - RunOnce in Foreach -
i'm writing little scripting language bit of fun , learning of codes :p
i opinions/suggestions. have idea don't want include people going want spit on. plan on making language open source once, soon.
does think cool have like:
[foreach] uppercase letter s in case-insensitive word sallysawtheseafishandateit: count++. s.highlight: true. runonce.protectedmethod.activateprotectedmethod: istrue. [protected method.lockto: [foreach]].istrue statusbar.message: match s found. total: count.. runonce.protectedmethod.disable.
explanation: above searches through string of text "sallysawtheseafishandateit" , highlights every single match. when finds first match "s", runs method called "istrue", , sets statusbar text "match found...". , deactivates runonce method may no longer accessed, since there's no need run again.
this might not best example, think idea. there have been plenty of times i've needed once in foreach loop, couldn't, without writing whole bunch of other code.
i figure, atleast way, can done in 2 methods.
please brutally honest. :)
thank you
this seems over-complication of following structure (in java style):
boolean ranonce = false; (char c : string.tochararray()) { if (c != 's') continue; if (!ranonce) { // stuff once ranonce = true; } // other stuff }
it seems extreme over-engineering me, when single boolean , if condition trick.
Comments
Post a Comment