Implicit conversions.

In TimeHelpers.scala we have:

1. TimeSpanBuilder which contains method minutes, seconds etc.
2. And the implicits such as:  implicit def intToTimeSpanBuilder(in:
Int): TimeSpanBuilder = TimeSpanBuilder(in)

therefore compiler automatically applies intToTimeSpanBuilder
(10).seconds as the type of object 10 has no minutes method. So "10
minutes" will yield a TimeSpan instance.

Still you can use (3 + (10 seconds)) because there is another implicit
conversion implicit def timeSpanToLong(in: TimeSpan): Long = in.millis
to convert from a TimeSpan to a Long hence (10 minutes) can be used in
arithmetic operations.


Br's,
Marius

On Jul 31, 3:10 pm, Caesar You <ucae...@gmail.com> wrote:
> Hi everyone, i am a rookie of lift and scala.
>
> now i am cofused about sth in the lift. Line 226 in
> LiftSession.scala
>
>      "ActorPing schedule (this, CheckAndPurge, 10 seconds)"
>
> Does anybody tell me how "10 seconds" works? that is how does the
> scala convert it to type TimeSpan?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to