Skip to content

Conversation

@nainar
Copy link
Contributor

@nainar nainar commented Jun 5, 2017

@shans could you take a look?

This hopefully adds the text needed for issue #404


3. If there are at least two different [=strong types=]
among the [=list/items=] in |values|,
[=throw=] a {{TypeError}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to throw a TypeError here or return a min/max expression?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing a TypeError is correct. You can't compare a length to an angle; doing so will be rejected as a syntax error in CSS, and throws a TypeError here in JS.

the {{CSSUnitValue/value}} internal slots
of the [=list/items=] in |values|.

5. If |this| is a {{CSSMathMin}} object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should talk to Tab about in-place modification, not sure it's actually what we want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh shoot, you're right, I didn't intend to do an in-place modification in the add() function. My intention is just that, if you already have a Sum, we should just create a larger Sum with all the values, rather than nesting the Sums.

That is, CSS.num(1).add(1).add(2) should give the same result as CSS.num(1).add(2, 3).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, go ahead and stay consistent for this; I need to rewrite the math functions now to take advantage of the proper type system. :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I've done that now, so instead be consistent with text of the new functions. ^_^

the {{CSSUnitValue/value}} internal slots
of the [=list/items=] in |values|.

5. If |this| is a {{CSSMathMin}} object,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh shoot, you're right, I didn't intend to do an in-place modification in the add() function. My intention is just that, if you already have a Sum, we should just create a larger Sum with all the values, rather than nesting the Sums.

That is, CSS.num(1).add(1).add(2) should give the same result as CSS.num(1).add(2, 3).


3. If there are at least two different [=strong types=]
among the [=list/items=] in |values|,
[=throw=] a {{TypeError}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing a TypeError is correct. You can't compare a length to an angle; doing so will be rejected as a syntax error in CSS, and throws a TypeError here in JS.

the {{CSSUnitValue/value}} internal slots
of the [=list/items=] in |values|.

5. If |this| is a {{CSSMathMin}} object,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, go ahead and stay consistent for this; I need to rewrite the math functions now to take advantage of the proper type system. :(

@nainar
Copy link
Contributor Author

nainar commented Jun 9, 2017

@tabatkins take a look please?

If |type| is failure,
[=throw=] a {{TypeError}}.

4. Return a new {{CSSMathMin}} object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max. ^_^ (Several places in here.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/facepalm.

Done.

Copy link
Contributor Author

@nainar nainar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tabatkins take a look? Thanks!

If |type| is failure,
[=throw=] a {{TypeError}}.

4. Return a new {{CSSMathMin}} object
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/facepalm.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants