coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

Request: Allow types to be specified in function declarations and support interface concepts

Open m1sta opened this issue 12 years ago • 4 comments

Typescript is important from a team-scalability perspective. Coffeescript is important from a productivity and maintainability perspective (although these obviously impact team-scale concepts too).

It would be fantastic if we could optionally write functions like the following...

myFunc = (a:String or Number, b:Person) -> 

.... so that IDE's could quickly give us hints on types. Type inference is a better alternative in most instances but even the best IDE's are still struggling with how to do this well without hinting.

I've recently being getting a lot of use out of a utility function with the signature below specifically to provide a hint to a custom IDE extension (plus a little simple exception throwing), but such an approach is never going to spread...

confirmArgumentTypes arguments, {a:[String, Number], b:Person}

m1sta avatar Aug 06 '13 23:08 m1sta

Agreed, this would be a huge improvement, I think Typescript is great. Just might not be doable without an unmergable fork away from mainline CoffeeScript

On Tue, Aug 6, 2013 at 7:12 PM, m1sta [email protected] wrote:

Typescript is important from a team-scalability perspective. Coffeescript is important from a productivity and maintainability perspective (although these obviously impact team-scale concepts too).

It would be fantastic if we could optionally write functions like the following...

myFunc = (a:String or Number, b:Person) ->

.... so that IDE's could quickly give us hints on types. Type inference is a better alternative in most instances but even the best IDE's are still struggling with how to do this well without hinting.

— Reply to this email directly or view it on GitHubhttps://github.com/maxtaco/coffee-script/issues/82 .

maxtaco avatar Aug 07 '13 00:08 maxtaco

True. Maybe this should be an issue in the main coffeescript branch instead then?

m1sta avatar Aug 08 '13 05:08 m1sta

Yeah! Might already be there, worth a check. On Aug 7, 2013 10:30 PM, "m1sta" [email protected] wrote:

True. Maybe this should be an issue in the main coffeescript branch instead then?

— Reply to this email directly or view it on GitHubhttps://github.com/maxtaco/coffee-script/issues/82#issuecomment-22303663 .

maxtaco avatar Aug 08 '13 06:08 maxtaco

contracts.coffee has always interested me. I wonder what iced+contracts would look like...

doublerebel avatar Sep 16 '13 03:09 doublerebel