[Opa] looks like unicode problem

Paulo J. Matos paulo at matos-sorge.com
Tue Aug 30 09:23:48 EDT 2011


Hi,

I am following the demo of the chat room and with the code (file attached):

type message = {author: string; text: string}

room = Network.cloud("room"): Network.network(message)

start() =
(
         author = Random.string(8)
         <div id=#header><div id=#logo></div></div>
         <div id=#conversation></div>
         <input id=#entry/>
         <div class="button">Send!</div>
)

broadcast(author) =
(
         text = Dom.get_value(#entry)
         message = {author=author, text=text}
         do Network.broadcast(message, room)
         Dom.clean_value(#entry)
)

user_update(x: message): =
(
         line = <div class="line">
                     <div class="user">{x.author}:</div>
                     <div class="message">{x.text}</div>
                </div>
         do Dom.transform([ #conversation +<- line ])
         Dom.scroll_to_bottom(#conversation)
)

I get the following in the terminal:
$ opa test.opa
In test.opa [17:38-17:38 | global chars=405-405]
Syntax error at line 17, column 38
The error may be in the following citation, usually in the red part  
(starting at ⚐) or just before:
<<)

broadcast(author) =
(
         text = Dom.get_value(#entry)
         message = {author=author, text⚐=text}
         do Network.broadcast(message, room)
         Dom.clean_value(#entry)
)

u>>
Hint: expected "," or "->" or ":" or "as" or <spacing>
(while parsing <pattern> starting at line 17, column 33)
Error
Syntax error


The strange thing is the character in the message assignment line  
after 'author=author, text'.
Any idea of what's happening?

Cheers,
-- 
PMatos



More information about the Opa mailing list