dojo / core

:rocket: Dojo 2 - language helpers and utilities.
http://dojo.io
Other
213 stars 62 forks source link

Update outdated core documentation in regards to shims #213

Closed Buslowicz closed 7 years ago

Buslowicz commented 7 years ago

Hello all. There are some utilities (in array, math and string), that seem to match es6/7 specs. Why not to polyfill them so it can be used directly from the prototype/global object, instead of exporting new object with those methods? That would later help refactoring projects once those are fully implemented. Cheers, Dracco

dylans commented 7 years ago

In general we try to avoid extending built-ins because we don't want to risk introducing something that ends up being incompatible. There are further details in https://github.com/dojo/shim/blob/master/README.md . That said, if it makes more sense to treat more of dojo/core as a shim, we could revisit that decision. Features that are shims should probably be moved to dojo/shim. Thoughts @kitsonk ?

Buslowicz commented 7 years ago

All methods from dojo-core/array work exactly like their originals from ES specs (of works just as Array function). In dojo-core/string only escapeRegExp and escapeXml are not standard methods. All the rest work like ES methods. As for dojo-core/math, it would be rather annoying if some of the math functions were in the native Math object, and other (also included in ES specs) would be accessible from the other object. That's just my few cents to the topic :).

kitsonk commented 7 years ago

All the ES6/ES7 like functionality was moved to dojo-shim @dylans.

There is no array, math or string anymore and the remaining non-spec string functions were moved to stringExtras to avoid any confusion. It has been this way since early July.

It would be good if we could talk about things that are actually in master. 😄

Buslowicz commented 7 years ago

Ok, so the docs are a bit outdated :P. Still, as I checked stringExtras.ts there are padStart and padEnd functions. How are they different from es specs? Shouldn't that be a shim as well?

kitsonk commented 7 years ago

We already had dojo/shim#27 addressing that, though pulling it out of stringExtras was not reflected. It has been added.

There are several other proposals that are to be published with ES8 which are issues in dojo/shim.

Buslowicz commented 7 years ago

Got it :). Just realised issue was renamed ^^. No more questions here from me :).

dylans commented 7 years ago

This was resolved a few weeks ago.