On Mon, Nov 2, 2009 at 1:34 PM, Vesa <[email protected]> wrote:
>
> You're right about that. You probably wouldn't get very far without
> understanding that. I'm still concerned that I have to type
> unnecessary stuff to express myself without getting any gains in (new
>
A comma separated list of values inside a method call (ie, anything inside
parens) are arguments to the method, and not a list of names, in a
particular sequence that belong together.
This also means that you can have things like (I didn't run this through a
compiler, so syntax is off):
val someStandardDir = "dir1" :: "dir2" :: "dir3" :: Nil
Link( someStandardDir :: "file" :: Nil)
or
Link( fnThatCanCreateTheFirstBit() :: "finalBit" ::Nil)
All of which would harder to read, your way :)
Link("a" :: "b" :: nil) vs Link("a", "b")) :D
>
> - Vesa
>
> On 2 marras, 22:27, Jim Barrows <[email protected]> wrote:
> > On Mon, Nov 2, 2009 at 1:15 PM, Vesa <[email protected]> wrote:
> >
> > > Hi,
> >
> > > I was wondering few thing while reading lift examples. Could the Link
> > > class be turned into a case class so reading would improve? new Link
> > > ("a" :: "b" :: nil, false) could be RecursiveLink("a", "b") and new
> > > Link("a" :: "b" :: Nil) could be something like AbsoluteLink("a",
> > > "b"). This would at least eliminate the need to explain scala's list
> >
> > Shouldn't the reader already be aware of Scala's list construction, since
> > that is in fact the language we're using?
> > If you think Scala's list construction is difficult to for a new reader,
> I
> > think explaining a case class would be even more confusing.
> >
> > You might want to look at how case classes differ from a normal
> > class<http://www.scala-lang.org/node/258>as well.
> >
> > construction syntax to the reader. I found out extremely unintuitive
> >
> > > the syntax to create Links with dsl like ("help" :: "" :: Nil) ->
> > > true. This syntax is usually associated with generation of key-value
> > > pairs even in lift APIs and creates confusion (at least on my case). I
> > > guess varargs might be out of question if scala backward compatibility
> > > is considered, but I don't see a reason not to use case classes here.
> >
> > > - Vesa
> >
> > --
> > James A Barrows
> >
>
--
James A Barrows
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---