Description
What I'm proposing is the ability to supply default values for parameter lists (note the {}):
# this works:
constructor: (name, description = 'no description') ->
# so does this:
constructor: (@name, @description = 'no description') ->
# this does not works:
constructor: ({name, description = 'not described'}) ->
# nor this:
constructor: ({@name, @description = 'not described'}) ->
I was surprised when this didn't compile, considering you can set defaults for regular named arguments, and also destructuring arguments (i.e. all types of named arguments except parameter lists).
It'd also be nice to be able to describe parameter lists over multiple lines, but I couldn't think of a way to do it without making it rather ({ugly}), eg:
constructor: ({
@name
@description
}) ->
edit: the above actually works.
Additionally, the destructuring parameter lists syntax isn't mentioned in the docs anywhere, and the syntax is really neat:
class Man
constructor: ({@name, @description }) ->
dave = new Man
name: 'Dave'
description: 'a dude'
console.log "#{dave.name} is #{dave.description}"
edit: rewritten to use the term 'destructuring parameter lists' instead of 'unknown auto-assigned option things huh?'.
edit 2: clarified the ticket, as I didn't actually understand what I had written myself.