stamen / modestmaps-js

Modest Maps javascript port
http://modestmaps.com
566 stars 152 forks source link

Bring back Map::coerceLayer() #102

Closed shawnbot closed 12 years ago

shawnbot commented 12 years ago

@tmcw, this one is still biting us in the ass. I get that major revision numbers should be expected to break code, but there are still examples broken in alpha and the errors causes are totally cryptic and difficult to track down—especially if you're not familiar with the code.

MM.TemplatedLayer seems like a hasty afterthought, and it feels out of place because the function isn't actually a class constructor: it just returns a new MM.Layer instance. This means, among other things, that you can't extend it.

I really liked the flexibility that the old coercion behavior provided. Removing it breaks a bunch of our examples, all of the code in gh-pages, and several projects we're working on that benefit greatly from using the bleeding edge MMJS.

Can we bring it back, please?

tmcw commented 12 years ago

I can work on a proper implementation of TemplatedLayer, better error reporting, and fixing examples, but really want to see if there's a way to have a 'layers in, layers out' expectation. Also, coerceLayer could be a Modest Maps utility if that makes things easier to port.

shawnbot commented 12 years ago

Awesome, thanks Tom. I like the idea of MM.coerceLayer() a lot.

shawnbot commented 12 years ago

Also wondering if @migurski or @RandomEtc have any thoughts on this...