You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While attempting to document some CoffeeScript for the Google Closure Compiler, I realised that @param tags wouldn't correctly match up the compiled JavaScript when I used @variables in the parameter list.
Example:
###*
@param {number} footSize The size of the monkey's foot
###
setFootSize = (@footSize) ->
Compiles to:
var setFootSize;
/**
@param {number} footSize The size of the monkey's foot
*/
setFootSize = function(_arg) {
this.footSize = _arg;
};
Where the parameter comes out as _arg rather than footSize.
Any chance we would want to change this so that the parameters keep their names without the @ prefix? I know this was discussed when allowing @s in parameters lists came up, but I can't find the ticket.
What do people think?
The text was updated successfully, but these errors were encountered:
My original objection was about making footSize seem like an alias to @footSize, without actually being a true alias. Consider:
setFootSize = (@footsize) ->
footSize += 1 @footsize -= 1
[footSize, @footsize]
Agreed -- I don't think we should give them the same name, as the this property will always be set first, and changing the param later will have no effect.
If you'd like to document this for closure, you can always do it normally:
###*
@param {number} footSize The size of the monkey's foot
###
setFootSize = (footSize) ->
@footSize = footSize
While attempting to document some CoffeeScript for the Google Closure Compiler, I realised that
@param
tags wouldn't correctly match up the compiled JavaScript when I used@variables
in the parameter list.Example:
Compiles to:
Where the parameter comes out as
_arg
rather thanfootSize
.Any chance we would want to change this so that the parameters keep their names without the
@
prefix? I know this was discussed when allowing@
s in parameters lists came up, but I can't find the ticket.What do people think?
The text was updated successfully, but these errors were encountered: