bug?

13 views
Skip to first unread message

Artem Avetisyan

unread,
Mar 16, 2013, 2:51:17 PM3/16/13
to pogos...@googlegroups.com
This code

   $.ajax (url) {
     success = @(response)
       if (response.data :: Array)
         messages = [record.commit.message, where: record <- response.data]
         play commit (messages)
       else
         console.log(response)
         play_error()
     error = @(xhr, status, err)
       console.log(status, err)
       play error()
   }

errors:

:!pogo -c guts.pogo
guts.pogo:49
     success = @(response)
       if (response.data :: Array)
         messages = [record.commit.message, where: record <- response.data]
         play commit (messages)
       else
         console.log(response)
         play_error()
     error = @(xhr, status, err)
this cannot be used as a parameter


but with extra new line it is all good:

   $.ajax (url) {
     success = @(response)
       if (response.data :: Array)
         messages = [record.commit.message, where: record <- response.data]
         play commit (messages)
       else
         console.log(response)
         play_error()

     error = @(xhr, status, err)
       console.log(status, err)
       play error()
   }

why?

Tim Macfarlane

unread,
Mar 16, 2013, 7:14:20 PM3/16/13
to pogos...@googlegroups.com
Ah yes. Not actually a bug: you must have an empty line after an
indented block or it becomes the continuation of the same line that
started the block.

one
   block
two

Is the same as:

one @{ block } two

Whereas this:

one
   block

two

is this:

one @{ block }
two

I think it gets complicated when the "two" line contains an "=". It
thinks that the block is a parameter to a function. Understandably confusing!

I've updated the documentation on blocks and in the cheatsheet for more info.

Artem Avetisyan

unread,
Mar 16, 2013, 7:26:36 PM3/16/13
to pogos...@googlegroups.com
I see, makes sense, thanks!

The 'documentation on blocks' link is very helpful. Do my eyes deceive me, or is it not accessible from the website?

Tim Macfarlane

unread,
Mar 16, 2013, 7:38:33 PM3/16/13
to Artem Avetisyan, pogos...@googlegroups.com
It is, but from links on the cheatsheet. Need a proper index, for me to do next...
--
You received this message because you are subscribed to the Google Groups "pogoscript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pogoscript+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tim Macfarlane

unread,
Mar 17, 2013, 7:04:18 PM3/17/13
to pogos...@googlegroups.com, Artem Avetisyan
Ok index done. Split the guide into individual files but left them all on the /guide/ page too. Now linkable from the cheatsheet page. Thanks for all your suggestions, really appreciated.

Tim.
To unsubscribe from this group and stop receiving emails from it, send an email to pogoscript+unsubscribe@googlegroups.com.

artem

unread,
Mar 18, 2013, 5:15:09 AM3/18/13
to Tim Macfarlane, pogos...@googlegroups.com
No worries! I'll keep an eye on things that don't seem right.
Reply all
Reply to author
Forward
0 new messages