How to namespace the require and define functions?

Coordinator
Jul 13, 2012 at 1:17 AM

Currently, the require and define functions are attached to the global object. This means that we have three globals (counting Hilo).

Originally, we made these global because of their similarity to functions specified/implemented by AMD, CommonJS, and Node.

However, it was suggested that attaching these functions to the global object is not a good idea for the following reasons:

  • Some might interpret them to be part of the platform itself.
  • Some might assume that they implement the actual specifications in AMD/CommonJS.

We do not want to attached them to a namespace such as WinJS, because that lead to similar incorrect assumptions.

Two leading proposals are:

  • attach them to Hilo
  • create a new namespace, such as pnp

What other do you prefer? What other options exist?

Jul 16, 2012 at 4:13 PM

I think it would be appropriate to start with the Hilo namespace, as this was built for this project specifically. If (when?) we come to a point where we recognize that this is the direction that we want our code to head, and this is the guidance that we want to give to other developers, then moving it to a PnP namespace would make more sense.

Personally, I would like to explore the "why" behind this before we make any kind of decision. I have an idea of what the surface level reasoning was behind this, but I'm never happy with just that. I want to dig deep and and feel the pain of the problems that caused this solution to exist. I want to know the problem statement, the constraints we have to work with, and explore all of the possible solutions to the problems to see what answers we can come up with.

If we explore other options and find out this is the best one, then that's great. If we find other options that require less framework-y code to be added in to a project, then that's even better. :)

Coordinator
Jul 16, 2012 at 9:04 PM

Agreed. I would like strong critical feedback about the require/define functions and their necessity.