On 11/13/2013 09:33 PM, Sieghard wrote:
> You could also decide to make "pos" take a return variable parameter 
> for the position, as this would nearly always be neccessary. Its 
> return value would then be a boolean, indicating whether the substring 
> was found. You might provide an overloaded version without the return 
> variable paramter for the rare case where you just want to check for 
> _presence_, but are not interested in the _position_ itself. And 
> maybe, an overloaded version also for compatibility that returns an 
> ordinalized boolean result (for uses as shown above). 

Pro:
(1) because the position does not have a "traditionally usable" value 
with UTF-16 (or UTF-8), the meaning of pos() is not really what it used 
to be as it was invented for ANSI
(2) doing a version that causes a compiler error is less problematic 
when porting legacy code

Con:
(1) if the position is needed, you need to introduce a variable and 
(alas) Martin declined to allow for intermediate variables within the 
function body
(2) you can't do (sensible) constructs like str1 := copy (str2, 
pos(str3, str2) + length(str2), 10);

-Michael


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to