Timothy Perrett schrieb:
>> The two defs only make sence together, that's why I put them together in
>> one def. I think that's encapsulation...> - dont use while loops. period.
>> you have a List[T], use foreach if you have a unit operation
>>
>>
>
> If you want encapsulation, because they "only make sense together",
> stick them in a trait - something about this inner def for your use
> case feels very wrong.
>
>
>> Yeah, that's true. But the problem is, that my logic requires to stop
>> the iteration at some point. How I gonna do that with a foreach construct?
>>
>
> This is where I think you should evaluate your thinking. "stoping
> iteration" is a java way of working... in scala i would typically
> filter the list before iterating on it:
>
> orders.filter(<predicate>).foreach(order => { ... })
>
> That seems to be a lot neater - my point was more "go look at the
> other method options on List[T]" rather than "the code i show here is
> the defacto way for your use case".
>
OK, I'm going to figure out, how to transform the while-loop into a
foreach....
>
>> I agree with you, that this is not the most beautiful code I every saw,
>> but I believe that the things you mentioned are not interfering with the
>> problem I'm facing. At least not because of a while-loop and some inner
>> local defs.
>>
>
> Are you calling this code in a try, catch, finally block by any
> chance?
>
In gets called from an Actor, everytime a new LimitOrder is created.
> Tim
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.