Re: Short Circuiting
- Posted by Hawke <mdeland at NWINFO.NET> Jun 24, 1998
- 585 views
Ralf Nieuwenhuijsen wrote: > if this then > if that () then > .. > end if > end if > > In other words, short-circuiting is a very clumbsy things and results in > very weird errors and it is very inconsistent. > The that () function should always be called. > Please, don't implent short-circuiting. ummmm...no. up till now i agreed with all of your arguments and examples ralf. short-circuiting(SC) is a necessary tool in programming. often implemented by a programmer without them realizing it. SC is a often a major optimization to coding... classes in boolean logic teach 'tricks' to determining what cases occur most often and what cases can be completely, utterly avoided from conditional checking. this is the case here. the that() function should NOT always be called. if this is false, there is no need for calling that(), ergo:optimization. on this issue, however, there is no need for Rob to implement SC in Euph. IMHO:if it can be done already, in a manner that exacts no performance penalty and can also be made _clear_ to another coder, there is absolutely NO reason for modification to the interpreter. i see this as the case here. SC as it stands with if a and b then dothis end if becomes: if a then -->will SC if a and b...ergo:test case a needs to be -->the case that profile says occurs most often, with -->b not even being looked at if a is false if b then dothis end if end if is a very viable, clear, and non-performance compromising solution to the topic of SC. in closing, SC is indeed a needed tool, and an extremely powerful optimizer. however, nothing needs done by Rob for euphorians to implement this tool. we don't need &&, we don't need ||, we don't need ?:, and we don't need with SC on/off. we either have mechanisms that accomplish it elegantly, succinctly and efficiently, or sign the 'grammar' or 'syntax' issues off to a PreProcessor or subroutine...if u don't like the syntax, change it... why? because you _can_. please do not change the euphoria core, it actually has _more_ than it realllllllyyyyyyyyyyyy needs right now anyway. Hawke'