I saw code like this
override def readPermission_? = true
override def writePermission_? = true
protected def i_obscure_!(in : BigDecimal) = defaultValue
protected def real_i_set_!(value : BigDecimal): BigDecimal = {
if (value != data) {
data = value
dirty_?(true)
}
data
}
My question is if there is some implied meaning by ending a field in
_! or not? It seems confusing as a newbie to have that when scala has
an _ operator and a _*. I got confused with names like 'dirty_?'
and have to think 'is that an operator of some sort that I need to
lookup or is that just a name?
Thanks,
James
> My question is if there is some implied meaning by ending a field in
> _! or not? It seems confusing as a newbie to have that when scala has
> an _ operator and a _*. I got confused with names like 'dirty_?'
> and have to think 'is that an operator of some sort that I need to
> lookup or is that just a name?
Can't speak for their specific etymology in lift, but this kind of usage
of '?' and '!' has a long history in other functional languages.
Scheme, in particular, has a strong convention that a predicate (no side
effects, returns a boolean answering questions about a piece of data
ends in '?', and an imperative or destructive operation (changes a piece
of data in-place, instead of returning a new object and is thus execute
for its side effects), ends in '!'.
The addition of '_' in lift is stylistic, I guess...
--
Jim Wise
jw...@draga.com
I am reading through the lift book to start getting an understanding
of lift.
I saw code like this
override def readPermission_? = true
override def writePermission_? = true
protected def i_obscure_!(in : BigDecimal) = defaultValue
protected def real_i_set_!(value : BigDecimal): BigDecimal = {
if (value != data) {
data = value
dirty_?(true)
}
data
}
My question is if there is some implied meaning by ending a field in
_! or not? It seems confusing as a newbie to have that when scala has
an _ operator and a _*. I got confused with names like 'dirty_?'
and have to think 'is that an operator of some sort that I need to
lookup or is that just a name?
Thanks,
James
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
--
Jim Wise
jw...@draga.com
> The "_" is required by the Scala parser. open! is not a valid method name, but open_! is valid.
Aha!
--
Jim Wise
jw...@draga.com
Thanks_!
On Jan 8, 3:14 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
> Why is Box.open_! nasty? is it just returning the value held in Box?
>
> Thanks_!
Or throwing an exception if the box is not Full()...
--
Jim Wise
jw...@draga.com
Boxing values keeps things far more managable
Cheers, Tim
Sent from my iPhone
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/liftweb?hl=en.
>>
>> --
>> Lift, the simply functional web frameworkhttp://liftweb.net
>> Beginning Scalahttp://www.apress.com/book/view/1430219890
>> Follow me:http://twitter.com/dpp
>> Surf the harmonics- Hide quoted text -
>>
>> - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
> --
> You received this message because you are subscribed to the Google
> Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com