Breaking change to Batman.Set will be released in v0.17

23 views
Skip to first unread message

Robert Mosolgo

unread,
Jul 7, 2014, 2:17:57 PM7/7/14
to batm...@googlegroups.com

Hi everyone,

We've recently merged a breaking change into batman/master and wanted to give you all the info you need to upgrade when the time comes!

The change affects the Batman.Set and Batman.SimpleSet constructors. Previously, you would create Sets by passing the contents as multiple arguments. From now on, you must create Sets by passing an array of contents as a single argument. Here's an example:

someArray = [1, 2, 3]

# OLD
someSet
= new Batman.Set(1, 2, 3)
someSet
= new Batman.Set(someArray...)

# NEW
someSet
= new Batman.Set([1, 2, 3])
someSet
= new Batman.Set(someArray)

We found this to be the more intuitive approach, while also being much more performant by avoiding the stack expansion.

Besides this change to the constructor, we've also added Set::addArray and Set::removeArray.

This update will be released in batman.js v0.17.0.

Thanks!

Dan Ott

unread,
Jul 7, 2014, 2:43:46 PM7/7/14
to batm...@googlegroups.com
What if your set is intended to be initialized with elements that are arrays?

--
Dan Ott
> --
> You received this message because you are subscribed to the Google Groups "batman.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to batmanjs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Robert Mosolgo

unread,
Jul 7, 2014, 3:06:10 PM7/7/14
to batm...@googlegroups.com
If you pass more than 1 argument to the constructor (or, if the argument isn't an array), you'll get a deprecation error. 

If you pass 1 argument and it's an array, it will be used to initialize the set. So, you'd have to catch it yourself! The upgrade in that case would look like this:

# A Batman.Set whose members are arrays

# old
new Batman.Set([1, 2])

# new
new Batman.Set([[1, 2]])


robert

On Monday, July 7, 2014 11:43:46 AM UTC-7, Dan Ott wrote:
What if your set is intended to be initialized with elements that are arrays?

--
Dan Ott



> Hi everyone,
>
> We've recently merged a breaking change into batman/master and wanted to give you all the info you need to upgrade when the time comes!
>
> The change affects the Batman.Set and Batman.SimpleSet constructors. Previously, you would create Sets by passing the contents as multiple arguments. From now on, you must create Sets by passing an array of contents as a single argument. Here's an example:
>
>
>
> someArray = [1, 2, 3]
>
> # OLD
> someSet = new Batman.Set(1, 2, 3)
> someSet = new Batman.Set(someArray...)
>
> # NEW
> someSet = new Batman.Set([1, 2, 3])
> someSet = new Batman.Set(someArray)
>
> We found this to be the more intuitive approach, while also being much more performant by avoiding the stack expansion.
>
> Besides this change to the constructor, we've also added Set::addArray and Set::removeArray.
>
> This update will be released in batman.js v0.17.0.
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "batman.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to batmanjs+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages