Yes.
The same applies to ToNumber: v8::Value::ToNumber doesn't match
`Number(value)` as the comment claims but rather the ToNumber internal
ECMAScript operation.
Similarly, v8::Value::{ToInteger,ToInt32,ToUint32} don't "Perform the
equivalent of `Number(value)` in JS". And what's that about "undefined
results" in the description of ToInteger?!


On Mon, Jul 31, 2023 at 5:27 PM Leszek Swirski <lesz...@chromium.org> wrote:

> @Jakob Kummerow <jkumme...@google.com> , I think this sounds reasonable
> and we should update the documentation to match?
>
> On Mon, Jul 31, 2023 at 5:02 PM 'Maksim Orlovich' via v8-dev <
> v8-dev@googlegroups.com> wrote:
>
>> One minor related thing I noticed --- the comment for v8::Value::ToBigInt
>> seem off:
>>
>>   /**
>>    * Perform the equivalent of `BigInt(value)` in JS.
>>    */
>>   V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt
>>
>> I think it actually implements the ToBigInt operation (which is what I
>> would expect from the name), not what the BigInt function does --- in
>> particular it rejects numbers, as ToBigInt is written to do, rather than
>> accept some of them as BigInt does.
>>
>> e.g. :
>> -> BigInt(12)
>> <- 12n
>>
>> vs.
>> -> a = new BigInt64Array();
>> <- BigInt64Array [buffer: ArrayBuffer(0), byteLength: 0, byteOffset: 0,
>> length: 0, Symbol(Symbol.toStringTag): 'BigInt64Array']
>> -> a.fill(12)
>> <- VM206:1 Uncaught TypeError: Cannot convert 12 to a BigInt
>>     at BigInt64Array.fill (<anonymous>)
>>     at <anonymous>:1:3
>>
>> Thanks,
>> Maks
>>
>> On Mon, Jul 31, 2023 at 9:22 AM Maksim Orlovich <morlov...@google.com>
>> wrote:
>>
>>> Thanks!
>>>
>>> On Mon, Jul 31, 2023 at 6:08 AM Leszek Swirski <lesz...@chromium.org>
>>> wrote:
>>>
>>>> ... and landed in
>>>> https://chromium-review.googlesource.com/c/v8/v8/+/4727691
>>>>
>>>> On Fri, Jul 28, 2023 at 4:03 PM Leszek Swirski <lesz...@chromium.org>
>>>> wrote:
>>>>
>>>>> Hi Maks,
>>>>>
>>>>> We have these on our internal API, but I think they aren't exposed on
>>>>> the public one. I can add them.
>>>>>
>>>>> - Leszek
>>>>>
>>>>> On Thu, Jul 27, 2023 at 5:28 PM Maks Orlovich <morlov...@chromium.org>
>>>>> wrote:
>>>>>
>>>>>> Hi... Is there any way of calling the ToNumeric (or ToPrimitive) spec
>>>>>> operations via the v8 public API (without re-implementing them by hand)?
>>>>>> They seem necessary to implement
>>>>>> https://webidl.spec.whatwg.org/#converted-to-a-numeric-type-or-bigint
>>>>>>
>>>>>> Thanks,
>>>>>> Maks
>>>>>>
>>>>>> --
>>>>>
>>>>>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3Roz%3DdkhKd-iVrEYC5gcRhENHhgWvSnkS%3D8yJZ4wCgy2A%40mail.gmail.com.

Reply via email to