Do methods ending with _! such as delete_! or i_is_! have a special meaning? Are they “just names”? Do they follow some convention? There’s even bulkDelete_!!. (The specific context is Lift if it makes a difference.)
Do methods ending with _! such as delete_! or i_is_! have a special meaning?
Share
I’m not sure what the convention is for using
_!and_!!in Lift, but here’s a bit of background.Any alphanumeric identifier can have _ and a list of symbols added and still be parsed as a single identifier. For example:
(In fact, you can parse almost anything as an identifier if you surround it with backticks–and this is what you do if a Java class uses a Scala reserved word, for example. Or if you want spaces in your identifiers.)
The compiler only recognizes one symbolic ending specially, however. If there is a method that looks like a getter, then getter_= will be interpreted as a setter. (Whether you actually use it as a setter is up to you; it will have the semantics of a setter, anyway.) So
In addition, the compiler reverses the order of caller and callee in any method that ends in
:. This is most often seen in lists:newElement :: existingListis actually a call toexistingList.::(newElement). So, for example:Any other usage of
_+ symbols is convention.