Skip to content

[Feature request] Import keyword #327

Closed
@TomasM

Description

@TomasM

Hi,

I'm working on an experimental framework with coffeescript. All my classes/mixins are namespaced like this:

MyFrameworkNamespace.Mixin.Observable: {}
MyApp.Class.Controller.Index: {}

...and so on. In my code I do:

 ( ->

  # Import classes/packages into this closure
  Index: MyApp.Class.Controller.Index
  Mixin: MyFrameworkNamespace.Mixin

  c: new Index()
  $.extend(true, c, Mixin.Observable)

 )()

Now idealy i would like a smart Import keyword that would do the imports for me:

( ->

  # Loops through MyFrameworkNamespace.Mixin and imports all mixins
  import MyFrameworkNamespace.Mixin.*
  # import into variable Ind
  import MyApp.Class.Controller.Index as Ind

  c: new Ind()
  $.extend(true, c, Observable)
  
)()

The implementation for this would be very simple. What do you think about this?

EDIT:

Perhaps this would be allowed as well:

from MyNameSpace.Mixin import Observable, Enumerable as Enum, Countable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions