|
Re: Escaping cannot be mixed with values: msg#00060lang.scala
Hello Molár, First of all sorry for answering this late. You are right, the phonebook3 example contained several errors, some syntactic, and some logical. Since it would be too embarrassing to go through the errors :-o, I just put an updated version on http://lamp.epfl.ch/~emir/projects/scalaxbook/scalaxbook.docbk.html The error message you give in the subject line is a known limitation - you cannot mix sequences with values in order to get a new sequence. Recalling that the last parameter of Elem is of type Node*, it means you can do Elem(........., myList:_*) to pass a value that is already a sequence but you cannot do Elem(........., myfirstNode, mySecondNode, mySeq:_*) in order to construct a new sequence from new values and existing sequences. The workaround is to construct a list yourself, before passing it in an escaped fashion e.g. Elem(........., ( myfirstNode :: mySecondNode :: mySeq.toList ):_*). Since Scala >= 1.4 there is a method `concat' in trait Seq that allows sequences to be concated in constant time (but it will make iteration a bit slower). So you can avoid the `.toList' if you fear performance will be negatively affected. I had that feature (mixing sequences and values) built in for a while (the compiler would construct the list for you), but we decided that it was to hard to specify and to sequence-specific. No nice xduce style embedded sequences, I am afraid. hope this helps. Burak Molnár Balázs wrote: Hello, -- Burak Emir http://lamp.epfl.ch/~emir |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: against the components utopia: 00060, Lex Spoon |
|---|---|
| Next by Date: | Re: scalac2: 00060, Lex Spoon |
| Previous by Thread: | Escaping cannot be mixed with valuesi: 00060, Molnár Balázs |
| Next by Thread: | escaping cannot be mixed with values: 00060, Molnár Balázs |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |