Giter Club home page Giter Club logo

coffee-script's Introduction

                                  ICED
    
                                   _____       __  __
                                  / ____|     / _|/ _|
 .- ----------- -.               | |     ___ | |_| |_ ___  ___
(  (ice cubes)    )              | |    / _ \|  _|  _/ _ \/ _ \
|`-..________ ..-'|              | |___| (_) | | | ||  __/  __/
|                 |               \_____\___/|_| |_| \___|\___|
|                 ;--.
|                (__  \            _____           _       _
|                 | )  )          / ____|         (_)     | |
|                 |/  /          | (___   ___ _ __ _ _ __ | |_
|                 (  /            \___ \ / __| '__| | '_ \| __|
|                 |/              ____) | (__| |  | | |_) | |_
|                 |              |_____/ \___|_|  |_| .__/ \__|
 `-.._________..-'                                  | |
                                                    |_|

CoffeeScript is a little language that compiles into JavaScript. IcedCoffeeScript is a superset of CoffeeScript that adds two new keywords: await and defer.

Installation

If you have the node package manager, npm, installed:

npm install -g iced-coffee-script

Leave off the -g if you don't wish to install globally. If you don't wish to use npm:

git clone https://github.com/maxtaco/coffee-script.git
sudo coffee-script/bin/cake install

Getting Started

Execute a script:

iced /path/to/script.coffee

Compile a script:

iced -c /path/to/script.coffee

For documentation, usage, and examples, see: http://maxtaco.github.io/coffee-script/

To suggest a feature or report a bug: http://github.com/maxtaco/coffee-script/issues

If you'd like to chat, drop by #coffeescript on Freenode IRC.

The source repository: https://github.com/maxtaco/coffee-script.git

Our lovely and talented contributors are listed here and here.

coffee-script's People

Contributors

alubbe avatar asalant avatar breckinloggins avatar cehoffman avatar codelahoma avatar danielgtaylor avatar davidchambers avatar epidemian avatar geraldalewis avatar hden avatar imcotton avatar jashkenas avatar jeremybanks avatar matehat avatar maxtaco avatar michaelficarra avatar mklement0 avatar satyr avatar sgentle avatar sparecycles avatar spinda avatar sstephenson avatar stanangeloff avatar thejh avatar tim-smart avatar trevorburnham avatar troels avatar vendethiel avatar xixixao avatar zmthy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coffee-script's Issues

Errorhandling?

Hello,

I am using iced quite a lot ant it is totally awesome. Thanks for the great work. My question could probably already benn discussed, I would be totally satisfied with a link then. (I did not find anything.)

In the documentation you write, that try … catch … statements do not work with await and defer. (Which is obviously true.)
For me this results very often in code like this:

fn1 = (cb) ->await fn2 defer error, value
  return cb error if error?cb null, value

I use callbacks, which always take errors as first argument, which I have also seen in some libraries.

So now my question: Is it theoretically impossible to make the javascript error handling work again? I thought about it and am seeing the caveats. But you most certainly now more about this matter.

If it is possible
I would actually be willing to contribute.
You could just point out a direction and i will give at try.
else
I would be very happy about some hints on how I can avoid my handmade error handling.

If this isn't the right place for a request like this, I apologize…

Greetings Malte

Can I use iced with .coffee file

I have large project with many file and want to change all to iced-coffe-script but I must change extension all files to .iced. Can I run iced with .coffee file?

Make `multi` accessible from outside Rendezvous

Use case: I'm writing a CPS interpreter. ICS has proven invaluable for simplifying the code, but the call-defer-once limitation means that I can't write generators that yield more than once. I could rewrite things to use Rendezvous, but that seems unnecessarily ugly.

It seems that the deferral ID and multiple-invocation features that Rendezvous provides are orthogonal, so I think it would be nice if we could have something like deferMulti. The downside is that this introduces an extra keyword; a compile-time flag could be a viable alternative.

for .. by is broken

This doesn't work as expected:

for i in [0..11] by 3
  await setTimeout defer(), 100
  console.log "#{i}"

Issue with await in switch statement

The following code:

foo = (callback) ->
  do callback

console.log 1

switch 'asd'
  when 'foo'
    await foo defer()
  when 'bar'
    x = 1

console.log 2

Outputs only "1" while it should output a "2" too. If you put a:

  when 'asd'
    x = 2

In the switch, then it works fine. But if none of the cases are matched, then Iced "blocks".

"-l" option doesn't work

Hi, I am having problems to run the linter... when i execute this:

iced --lint lib/afile.iced

I get this:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: write EPIPE
    at errnoException (net.js:670:11)
    at Object.afterWrite [as oncomplete] (net.js:503:19)

The version of node I am using right now is v0.6.17.

I did a little research and I found this "Consistent EPIPE error writing to stdout when pipe has disconnected"

other cs -> iced departures?

How wedded are you to CS's decision regarding the scope of variables? stuff like shadowing in a block, etc? I understand the arguments for and against, but I always seem to keep coming back to wishing they were there... especially for loop blocks. Just curious really.... iced looks awesome BTW....

detect when the wrong runtime has been chosen

I thought that my coffeescript knowledge would translated directly in ics and I missed the run time option. Probably it could be
possible to detect the environment is not appropriate to the current run time and provide a helpful message.

Await doesn't work with super

the following code bombs:

class A      
  get_number: (cb) ->
    # do ajax
    cb 10

class B extends A
  get_number: (cb) ->
    await super defer number
    cb number + 1

new B().get_number alert

Though it should function identically to this

class A      
  get_number: (cb) ->
    # do ajax
    cb 10

class B extends A
  get_number: (cb) ->
    super (number) ->
      cb number + 1

new B().get_number alert

Nested awaits ought to work or barf

As reported by @superjoe30:

atest "nested await", (cb) ->
   a = 10
   b = 11
   await 
     foo(a, defer x)
     await foo(b, defer y)
     foo(y, defer z)

   cb(x == a and y == b == z, {})

To solve this in coffee, we need to scope __iced_deferrals and have the closing __iced_deferrals.fulfill() be pushed down through the continuation chain.

defers doesn't work with destructive assignments

When the defer should be "return"ing a value that gets destructed, ICS doesn't destruct the discrete params correctly; you get a reference error if you try to use a destructed variable. For example:

test = (cb) ->
     cb({x:1})
await test defer({x}) 
alert(x) // throws "ReferenceError: x is not defined"

While, of course, a simple variable defer works:

test = (cb) ->
     cb(1)
await test defer(x)
alert(x)

While both options -- a destructed variable and a simple one, respectively -- work in plain coffee:

test = (cb) ->
     cb({x:1})
test ({x}) ->
    alert(x)
test = (cb) ->
     cb(1)
test (x) ->
    alert(x)

Rename to iced-coffee-script

Well, at first glance the repository name is very misleading. I look for iced-coffee-script then find out that it's just coffee-script with the branch iced.

Invalid Var

Shortening the example to....

search = ({keyword, cb}) ->
  host = "http://search.twitter.com/"
  url = "#{ host }/search.json?q=#{ keyword }&callback=?"
  await $.getJSON(url, defer json)
  cb({many: "things", in: "curly", results: json.results})
  return

await search({keyword: "sun+tacos", cb: defer {results: tweets} })
msg = tweets[0]?.text

alert msg ?  "<nothing found>"

The defer within the search for "sun+tacos" should handle the actual return object and pull tweets out of it. Currently, it compiles to the code below, which is invalid.

var msg, search, tweets, {
      results: tweets
    }, __iced_deferrals, __iced_k,
  _this = this;

__iced_k = function() {};
...

I really enjoy leveraging the curly object handeling within coffeescript. If this can be fixed, I'm sold. Thanks for the hard work!

Autocb with multiple arguments

This gives an “unexpected ,” error message:

foo = (autocb) ->
  return null, 42

Node.js-style async callbacks often accept multiple arguments (error and result, at least), so I cannot use autocb with them currently.

Looks like one could start investigating this with nodes.coffee line 760 (a node for Return statement), although the parser will need to be fixed too.

Return value from a function

This works!

fs = require "fs"

await fs.readFile("/etc/passwd", "utf-8", defer(err, arquivo))
console.log arquivo

But how I can return a value from function?

fs = require "fs"

file_method = ->
  await fs.readFile("/etc/passwd", "utf-8", defer(err, file))
  return file

file_return = file_method()
console.log file_return

Console says: undefined

Major issue with callback calling order

Note the following code:

class Test
  constructor: ->
    @foo =
      bar: (callback) ->
        console.log 2
        do callback
        console.log 4

  testBAD: ->
    console.log 1
    await @foo.bar defer()
    console.log 3

  testOK: ->
    console.log 1
    @foo.bar ->
      console.log 3

do (new Test).testBAD
do console.log
do (new Test).testOK

This outputs:

1
2
4
3

1
2
3
4

Which, obviously, is seriously wrong. :) Or am I horribly mistaken as to what await/defer mean? :)

% iced --version                                   
IcedCoffeeScript version 1.4.0a

iced coffee script place 'use strict' in wrong place

in iced-coffee-script,

"use strict"
a =
 a: 1
 'a': 2

will be compiled into:

var a;

"use strict";

a = {
  a: 1,
  'a': 2
};

that the "use strict"; should before any statement but it not.

while coffee-script will compile into:

"use strict";
var a;

a = {
  a: 1,
  'a': 2
};

which is correct.

Implement it as an optional TameJS post-processor for CoffeeScript?

Just wondering maybe it may make sense to implement it as tiny optional module for CoffeeScript?

I mean - add support for new language construct await into original CS, so it will convert

await setTimeout defer(), 100

into

await { setTimeout (defer (), 100); }

and postprocess it with TameJS after it. The changes will be very small compared to full inclusion of TameJS into CS source.

It will be also slower, because it will parse both CS and JS sources, but it will be more robust and require less work to support and update new versions.

What do You think?

Class.name is readonly in strict mode

in iced-coffee-script, class Class will be compiled into:

var Class;
Class = (function() {
  Class.name = 'Class';
  function Class() {}
  return Class;
})();

in strict mode while add "use strict"; in front
Class.name = 'Class'; thow exception because class.name is readonly

and i look at current verion of coffee-script it will not add Class.name = 'Class';:

var Class;
Class = (function() {
  function Class() {}
  return Class;
})();

Incorrect compilation from iced to javascript

I've got a problem when I tried to compile *.iced file (with await deffer functions) to javascript. It compiled without an errors, but contains iced object variable. So when I tried to run it with node I've got an error because this variable is undefined.

It can be fixed with one line in the head of the file
iced = require('iced-coffee-script').iced

but it's really annoying to add such line to every file with await-deffer pair.

It rocks!

Please man, don't stop... IcedCoffeeScript is awesome!

munge library import in generated code

This popped up when I was trying to use the better-stack-traces with iced-coffee-script. I was using:

iced = require 'iced-coffee-script'
require('better-stack-traces').install({ coffee : iced })

and was rather confused that everything started breaking. It looks like the generated output imports the iced-coffee-script library as 'iced' and so it was conflicting with my require. Would it make sense to prefix it like the other helpers (_iced*)?

`arguments` are mangled in continuations

As reported by @devongovett

fn = ->
  await setTimeout defer(), 1000
  alert arguments[0]

fn 'hi'

Two options, either use CS's pretty apply(this, arguments) technique, or do the ugly thing, with is to set var _arguments = arguments, as how _this = this is handled.

Errors with sample code on ICS site & server-side (node)

Hello, maybe smth is broken in current version but i cant run ICS without error on your tutorial site nor on server-side (node)

ICS site (client-side)

For example, go to http://maxtaco.github.com/coffee-script/ , click on Try It and paste sample code

for i in [0..10]
  await setTimeout(defer(), 100)
  console.log "hello"

Run and watch console: after executing (chrome 17.0.963.79 m) we've got an error:

Uncaught TypeError: undefined is not a function
_while
_continue
_while
require../iced.a.generator.d.Deferrals.b._call  coffee-script.js:8
require../iced.a.generator.d.Deferrals.b._fulfill   coffee-script.js:8
require../iced.a.generator.a.makeDeferReturn.j  coffee-script.js:8

Now about server-side

My conf is: Ubuntu 10.04, npm 1.1.4, nodejs v0.6.12, coffee-script 1.2.0 (-g), iced-coffee-script 1.2.0s (-g)

The same sample code snippet above works (iced -I inline iced.coffee) with error in the end:

timers.js:96
            if (!process.listeners('uncaughtException').length) throw e;
                                                                      ^
TypeError: undefined is not a function
    at /home/ubuntu/app1/iced.coffee:53:14
    at /home/ubuntu/app1/iced.coffee:49:14
    at _Class.continuation (/home/ubuntu/app1/iced.coffee:64:16)
    at _Class._fulfill (/home/ubuntu/app1/iced.coffee:16:40)
    at Object._onTimeout (/home/ubuntu/app1/iced.coffee:30:24)
    at Timer.ontimeout (timers.js:94:19)

If i'm trying to run in node mode (iced iced.coffee) with adding to the top of src iced = require('iced-coffee-script').iced, i've got this err:

Error: Cannot find module 'iced-coffee-script'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/home/ubuntu/app1/iced.coffee:5:10)
    at Object.<anonymous> (/home/ubuntu/app1/iced.coffee:37:4)
    at Module._compile (module.js:441:26)
    at Object.run (/usr/lib/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js:92:25)
    at /usr/lib/node_modules/iced-coffee-script/lib/coffee-script/command.js:152:29
    at /usr/lib/node_modules/iced-coffee-script/lib/coffee-script/command.js:127:18

`iced -c folder` doesn't find .iced files

Hi. If I have a folder src/script.iced, then the command iced -c src does nothing .

If my file were named src/script.coffee then iced -c src does something as I'd expect

Helper syntax for handling errors?

I really like how the await/defer structure helps writing async code. Lets go even further!

Currently, async error handling in node.js is a pain.

# Sample Express code with basic error handling
app.get '/', (req, res, next) ->
    db.readUsersList (err, users) ->
        if err? then return next(err)
        db.readArticles (err, articles) ->
            if err? then return next(err)
            res.render 'index', {users, articles}

# Sample Async code with basic error handling
readAndProcessFile = (filename, callback) ->
    fs.readFile filename, 'utf8', (err, text) ->
        if err? then return callback(err)  # Docs suggest to throw err, but its meaningless in async code. 
        process text, (err, result) ->
            if err? then return callback(err)
            callback null, result

As you can see, there are lots of if err? then return callback(err) everywhere, that's not good. Note that this is a very frequent pattern in asynchronous code.

I usually write a helper function to make the code a lot cleaner, something along the lines of:

# Error-handling helper. Use like this:
# asyncFunction params, errTo next, (results) ->
errTo = (next, callback) ->
    (err, params...) ->
        if err? return next(err)
        callback params...

# Sample Express code
app.get '/', (req, res, next) ->
    db.readUsersList errTo next, (users) ->  # Note no 'err' parameter.
        db.readArticles errTo next, (articles) ->
            res.render 'index', {users, articles}

So what can we do in IcedCoffeeScript? Lets see what can be done right now.

# Current way of error handling: same as in vanilla coffeescript, although a little cleaner because of lack of indentation.
app.get '/', (req, res, next) ->
    await db.readUsersList defer(err, users)
    if err? then return next(err)

    await db.readArticles defer(err, articles)
    if err? then return next(err)

    res.render 'index', {users, articles}

# Harder case: parallel fetching.
# I even dont know how to handle individual errors here.
app.get '/', (req, res, next) ->
    await 
        db.readUsersList defer(err, users)
        db.readArticles defer(err, articles)

    if err? then return next(err) # Not effective: waits for all deferreds to be fulfilled, also one error might overwrite the other.

    res.render 'index', {users, articles}

What's really lacking here is the semantics of try/catch clause, but with asynchronous twist and on a function level only (dont need to go up the stack). This is clearly hard to do in vanilla CoffeeScript, but I think might be doable in Iced.

Requirements:

  • The syntax should be easy to understand. Use familiar constructs.
  • Opt-in behavior. Should be easy to mix with the usual way of error handling.
  • Should help programmer in dealing with serial and parallel flows. I.e. stop iteration when error is first encountered.
  • Should look nice both in one-line form and block form of 'await'.
# Variant 1. Similar to my errTo helper
readAndProcess = (filename, cb) ->
    await fs.readFile filename, 'utf8', defer(~>cb, text)  # We can use any symbol instead of ~>. 
    await
        asyncOperation1 text, defer(~>cb, result1)
        asyncOperation2 text, defer(~>cb, result2)
    cb null, result1, result2

# Variant 2. Try/catch inspired
readAndProcess = (filename, cb) ->
    await fs.readFile filename, 'utf8', defer text catch cb

    await
        asyncOperation1 text, defer(result1)
        asyncOperation2 text, defer(result2)
    catch cb

    # Also, we can provide an error handler in-place:
    await
        asyncOperation1 text, defer(result1)
    catch (err) ->
        console.log err
        # Todo: do we allow return to the normal workflow?

    cb null, result1, result2

# Variant 3. Auto_cb automatically does this for the whole function
readAndProcess = (filename, auto_cb) ->
    await fs.readFile filename, 'utf8', defer(text) 
    await
        asyncOperation1 text, defer(result1)
        asyncOperation2 text, defer(result2)
    return {result1, result2}

What do you think? Is it doable for more generic case (ifs, whiles, etc.)?

Compiled JS includes additional dependency (buggy without wrapper)

Compiling iced CS to JS includes the problem that a new dependency is added: iced-coffee-script. CS' strength is that you can use the compiled JS out of the box, and iced should work in the same way: you can execute the compiled JS without any additional dependencies. Compiling a CS file with the -b flag will omit the wrapper, but the variable "iced" will be undefined.

can't final js output be more readable--like this?

compare this coffeescript implementation of serial and parallel process flow:

http://bit.ly/QZeIWZ

compare iced coffeescript equivalent(winner):

http://bit.ly/YFtJiu

(actually its not TOTALLY equivalent because in the second example, the parallel tests do not begin to execute until after the serial has completed. not sure how to notate that yet without a lot of extra stuff. but close enough to illustrate the point)

my conclusions:

  • iced coffeescript syntax is clearly easier to write
  • but why not have iced compile to pure-js version in the first example? its MUCH easier to follow.
  • my node.js colleagues will hate me for sharing libs compiled with iced coffeescript, since they read the .js first (debugging), and the coffee only if they have to make changes.

deferred argument cannot be passed to another asynchronous function

I may have misunderstood the purpose of await and defer but I understood it to implement delimited continuations.
This is not how it seems to work in practice. The intended operation of the following code under node.js should be reasonably clear. The continuation is passed to process.nextTick to be called later. What actually happens is that cont is called with undefined as its argument when control leaves testContinuation.
I have since noticed in this forum that nested awaits and multiple calls to these 'continuations' don't work either so I presume I have misunderstood the intention.

If this is the case, is there any reason that the full CPS transform has not been implemented?

class Test
    constructor: ->

    testContinuation: ->
        await
          @getContinuation defer val
          console.log "val = #{val}"

    getContinuation: (cont) -> process.nextTick -> cont "hello"

(new Test).testContinuation()

`defer()` arity

Hey,

It turns out that Socket.IO looks at the arity of callbacks (socketio/socket.io#268) and deferrals always have an arity of zero. (Some other JS libraries use functions’ arity too.)

It would be cool if deferrals had the right arity. I have a workaround which looks like this:

await …, ((cb) -> (arg) -> cb(arg))(defer(arg))
await …, defer(arg) # instead of this

Rails integration

What the easiest way to integrate iced into the rails asset pipeline? I've tried a couple of things but didn't get it to work.

library language features/extensions...

This is just a suggestion of a possible direction for coffee-script extension.

Make language extensions (like iced) live in a library instead of parallel forks/branches of the compiler.

benefits:

  • will make extending the language and experimenting simpler
  • will eventually make the core clean and more modular
  • let people experiment more with different ideas
  • keep the ecosystem united (people wanting to experiment will not move away from the upstream and most changes will make it upstream faster and in a cleaner manner)

the considerations that need to be made to make this worth while / convenient:

  • standardize a set of stable or official extensions that will be available by default
  • auto-install on first use (optional -- can be an extension in itself)
  • clear context rules (to avoid conflicts) -- I'd make this affect only the file containing the declaration
  • clear style/syntax guide-lines (to avoid conflicts)
  • clear syntax (IMO this has to be syntax), and I'd make it verbose-ish to be more noticeable by the person reading the code:
// beginning of file...
use CoffeeScript extension ICED

// user code...
...

X-posted: jashkenas#2080

Bug with "when" in "for" cycle

Take the following example:

baz = (callback) ->

bar = { a: 1 }

for o in [{ property: 'a' }, { property: 'b' }] when bar[o.property]?
  await baz defer()

This produces the following (wrong) code:

...
if (!(_i < _len)) {
      return _break();
    } else if (bar[o.property] != null) {
      o = _ref[_i];
...

You can see the value "o.property" being used BEFORE "o" is set which leads to a "TypeError: Cannot read property 'property' of undefined".

Edit:

% iced --version
IcedCoffeeScript version 1.3.3d

Can't get `this` from within a callback

Some libraries, instead of passing data as arguments to a callback, use "call" to yield data as this. For example:

getUser = (user_id, cb) -> cb.call(id: user_id, user_id)

await getUser 42, defer user
alert(user)

It is impossible to get this using defer keyword.

iced from npm has many garbage files

$ npm install [email protected]
$ cd node_modules/iced-coffee-script
$ ls
LICENSE                       c.iced                        lib
NAMES                         c.js                          media
README                        clean                         package.json
Rakefile                      d.iced                        x
a.iced                        d.iced~                       x.iced
b.iced                        d.js                          x.js
b.iced~                       e.iced                        x.out
b.js                          extras                        x.rb
bin                           iced-coffee-script-source.gem y.iced
c.coffee~                     iced.md                       z.js

a bug for for i in [0...N] await ...

we know that in coffeescript/iced
[0...4] is [0,1,2,3], and [0..3] is [0,1,2,3] too.
but follow code make different result:
x = []
fun1 = (cb) -> cb 1
for i in [0..3]
await fun1 defer(x[i])
==> x is [1,1,1,1]
for i in [0,1,2,3]
await fun1 defer(x[i])
==> x is [1,1,1,1]

for i in [0...4]
await fun1 defer(x[i])
x is [1,1,1,1,1]

i found that "for i in [0...4] await ..." generate js code like
....
if (!(i <= 4)) {
return _break();
} else {
.....
and iced "for i in [0..3] await ..." generate code all the same except it's 3 rather than 4.
....
if (!(i <= 3)) {
return _break();
} else {
.....

strange Unexpected 'INDENT' error

Hello, even if I have require ('iced-coffee-script'); it seems that I can't use await and for some reason I'm getting error.

my code looks like this:

class TestResource
  constructor : (@Server) ->

  new : (req, res) =>
    await
      @Server.api.get '/language', (err, _req, _res, languages) ->
        defer languages
      @Server.api.get '/label', (err, _req, _res, labels) ->
        defer labels
      @Server.api.get '/service', (err, _req, _res, services) ->
        defer services

    res.render 'test/new',
      languages : languages
      labels    : labels
      services  : services

also @Server.api is actually a restify jsonClient

The error I'm getting is:

Error: In /Volumes/Web/debian6/users/panosru/domains/example.com/public_html/apps/admin/core/Resources/test.coffee, Parse error on line 10: Unexpected 'INDENT'
    at Object.parseError (/Volumes/Web/debian6/users/panosru/domains/example.com/public_html/node_modules/coffee-script/lib/coffee-script/parser.js:470:11)
    at Object.parse (/Volumes/Web/debian6/users/panosru/domains/example.com/public_html/node_modules/coffee-script/lib/coffee-script/parser.js:546:22)
    at /Volumes/Web/debian6/users/panosru/domains/example.com/public_html/node_modules/coffee-script/lib/coffee-script/coffee-script.js:40:22
    at Object..coffee (/Volumes/Web/debian6/users/panosru/domains/example.com/public_html/node_modules/coffee-script/lib/coffee-script/coffee-script.js:18:17)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at /Volumes/Web/debian6/users/panosru/domains/example.com/public_html/apps/admin/core/Resources.coffee:67:23
    at /Volumes/Web/debian6/users/panosru/domains/example.com/public_html/apps/admin/core/Resources.coffee:23:21

17 Mar 03:34:35 - [nodemon] app crashed - waiting for file changes before starting...

seems that the error is produced by coffee-script but I use require('iced-coffee-script');

?= and ||= cant be used on defer function's argument

The following code can't be translated:

foo = (x, cb)->
  cb(x)

f = (x)->
  await foo(x, defer(bar))
  bar ||=  ""
  #bar ?=  ""
  alert bar

#THE VARIABLE "BAR" CAN'T BE ASSIGNED WITH ||= (or ?=)
# BECAUSE IT HAS NOT BEEN DEFINED

but this one can:

foo = (x, cb)->
  cb(x)

f = (x)->
  await foo(x, defer(bar))
  bar = bar || ""
  alert bar

Is that OK?

Iced doesn't work with valgrind

Hey,

I'm trying to debug some native nodejs extensions using valgrind but I can't use iced files. Coffeescript is broken in the same way too but I can compile the files to JS (using coffee -c) and it runs fine after that (running valgrind with node instead of coffee). But iced files explicitly require iced-coffee-script, which again in turn compiles files and it blows up there. The error is:

Object  has no method 'traverseChildren'
    at exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:210:22)
    at Value.exports.Base.Base.eachChild (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:199:17)
    at Value.exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:207:19)
    at exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:210:22)
    at Block.exports.Base.Base.eachChild (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:199:17)
    at Block.exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:207:19)
    at exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:210:22)
    at For.exports.Base.Base.eachChild (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:199:17)
    at For.exports.Base.Base.traverseChildren (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:207:19)
    at For.exports.Base.Base.icedClearAutocbFlags (... /node_modules/iced-coffee-script/lib/coffee-script/nodes.js:284:19)

I'm not sure this is your problem - most likely it is coffeescript's but I think you can give me a better answer than they can. :)

% iced --version
IcedCoffeeScript version 1.3.3f

% node --version
v0.8.11

Thanks for any suggestions!

Broken 'require' for Windows pathnames

When including a .coffee file (which must contain an await-defer) from a different directory and compiling with iced, e.g.

PrioList = require('./public/libs/util-priolist').PrioList

the following error occurs:

filename: "C:\Dokumente und Einstellungen\Dejj\Desktop\myproj\pin
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:437:25)

The error does not occur under Linux or if the file to be included is in the same directory or if no await-defer is present. Compiling the file under Windows with just coffee works fine too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.