Int64

Brendan Eich
Brendan EichCEO/President, Brave Software, Inc. at Brave Software, Inc.
JS
Brendan Eich
Brave Software
@BrendanEich
Int64 & More
Brendan Eich Brave Software @BrendanEich
Always bet on JS
There are only two kinds of languages: the
ones people complain about and the ones
nobody uses. — Bjarne Stroustrup
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Previous value/operator/suffix thinking…
• Int64(0) ==> 0L // as in C#
• Uint64(0) ==> 0UL // ditto
• Float32(0) ==> 0f // ditto
• BigInt(0) ==> 0N // N to avoid i/I
• Decimal(0) ==> 0m // m or M, C/F#
• User-defined suffixes and operators: | ^ & == < <= << >> >>>
+ - * / % ~ ToBoolean unary- unary+
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Time passed, SIMD faded, new plan needed
• Old plan was to build on SIMD landing in living spec.html
• I hoped we would get more general “value type” semantics that way
• But time matters; as Waldemar said in July, “we should just do Int64”
• And @mikeal and I said exact same thing to each other in September
• Insight: inducting from hardcoded Int64/Uint64 (with future-proofing) is
strictly better than chained risk and complexity of layering on SIMD
• This slide deck presents the status quo and sketches future proofs
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
The @littledan / @brendan BBQ design
• After a BBQ joint after-meeting in January 2016 near PayPal,
@littledan and I worked out (written up via Twitter DM) a better
direct (no SIMD) plan, which is worth a recap for its constraints
• We agreed on no implicit conversions, so binary operator dispatch
needs no new magic: runtime semantics throw rather than convert
so both operands have same Type
• Unary operators could be single-dispatch or 1-ary functions
• Literals and operators are separate proposals, details mostly TBD
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Notable future-proofing problem: ToBoolean
• Int64 and Uint64 zero values must be “falsy”, while SIMD all-zero
vectors are truthy
• Old sketch had ToBoolean operator on deck, but it would have to
be infallible, or optimizations suffer fatally (per Andreas Rossberg)
• New future-proof idea: numeric types (“value types”) declare their
canonical zero value (arithmetic identity; one of N in “zero cohort”)
• Bonus: also requiring numeric types to declare canonical unit (one,
multiplicative identity) wins for ++/— consistency and simplicity
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Consequences/examples for Int64 usage
• 1L + 2L // 3L
• let x = 4; console.log(x * 5L) // TypeError
• console.log(Int64(x) * 5L) // 20L
• 0x1FFFFFFFFFFUL * 2L // TypeError
• 0x1FFFFFFFFFFUL * 2UL // OK
• 0x1FFFFFFFFFFUL * Uint64(scale) // also OK
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Spec.html plan of attack and status
• Split “6.1.6 The Number Type” into subclauses of new Numeric Types
clause for Number, Int64, and Uint64
• Split “20.1 Number Objects” into subclauses of new Numeric Objects
clause for Number, Int64, and Uint64 constructors/prototypes/etc.
• Check all ToNumber uses to see which ones should be ToNumeric
• Refactor 12 Expressions semantics to delegate to Type(x)::op (see next)
• Revise Number uses such as SameValueNonNumber carefully (in that
case to be SameValueNonNumeric)
Int64
Int64
Int64
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Future possible “value class” syntax
• value class Decimal {

constructor(x) {…}

static zero = Decimal(0);

static unit = Decimal(1);

static [Symbol.unaryMinus](x) {…}

static [Symbol.bitwiseNOT](x) {…}

// etc…

static [Symbol.add](x, y) {…}

static [Symbol.subtract](x, y) {…}

// etc…

}
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Future possible literal suffix support
• value class Decimal {

suffix m = fromLiteral;

suffix M = fromLiteral;



static fromLiteral(s) {…} // may throw



// etc…

}

let three = 3M; // m and M in scope too
• Question: allow RegExp for early error on invalid literal?
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Regular expressions for early errors?
• /(d{1,19}|

17d{18}|

18[0-3]d{17}|

184[0-3]d{16}|

1844[0-5]d{15}|

...

18446744073709551615)

UL/
• Very ugly, hard to handle other radixes, etc. Just say no! Let user-
defined numeric types’ literals throw at runtime if malformed
Brendan Eich Brave Software @BrendanEich
Always bet on JS
Spec Tour
Always bet on
Brendan Eich Brave Software @ BrendanEich
JS
Feedback requests and next steps
• Publish a browsable modified spec via brendaneich.github.io

(may move to tc39.github.io - stay tuned on Twitter!)
• Auto-generate an ins/del version of https://github.com/brendaneich/
ecma262/spec.html and publish via gh-pages
• Finish “20.1 Numeric Objects” spec changes
• Incorporate feedback on detailed changes in published spec

e.g., known bugs on 0L / 0L, 2L ** -3L, etc. to fix
• Propose operators and (separate, later) suffixes/value classes
Int64
1 of 17

Recommended

Value objects in JS - an ES7 work in progress by
Value objects in JS - an ES7 work in progressValue objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progressBrendan Eich
22.7K views14 slides
Extensible Operators and Literals for JavaScript by
Extensible Operators and Literals for JavaScriptExtensible Operators and Literals for JavaScript
Extensible Operators and Literals for JavaScriptBrendan Eich
6.8K views14 slides
Value Objects, Full Throttle (to be updated for spring TC39 meetings) by
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Brendan Eich
16K views20 slides
JS Responsibilities by
JS ResponsibilitiesJS Responsibilities
JS ResponsibilitiesBrendan Eich
34.9K views34 slides
Web futures by
Web futuresWeb futures
Web futuresBrendan Eich
8.7K views40 slides
Fluent14 by
Fluent14Fluent14
Fluent14Brendan Eich
8.9K views40 slides

More Related Content

What's hot

Swift vs Objective-C by
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-CMindfire Solutions
2K views27 slides
Migration Objective-C to Swift by
Migration Objective-C to SwiftMigration Objective-C to Swift
Migration Objective-C to SwiftNattapon Nimakul
367 views12 slides
iOS NSAgora #3: Objective-C vs. Swift by
iOS NSAgora #3: Objective-C vs. SwiftiOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. SwiftAlex Cristea
1.4K views44 slides
Optionals by Matt Faluotico by
Optionals by Matt FaluoticoOptionals by Matt Faluotico
Optionals by Matt FaluoticoWithTheBest
246 views35 slides
Migrating Objective-C to Swift by
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to SwiftElmar Kretzer
360 views29 slides
Monte Carlo C++ by
Monte Carlo C++Monte Carlo C++
Monte Carlo C++Dmitri Nesteruk
765 views19 slides

What's hot(20)

iOS NSAgora #3: Objective-C vs. Swift by Alex Cristea
iOS NSAgora #3: Objective-C vs. SwiftiOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. Swift
Alex Cristea1.4K views
Optionals by Matt Faluotico by WithTheBest
Optionals by Matt FaluoticoOptionals by Matt Faluotico
Optionals by Matt Faluotico
WithTheBest246 views
Migrating Objective-C to Swift by Elmar Kretzer
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
Elmar Kretzer360 views
Railroading into Scala by Nehal Shah
Railroading into ScalaRailroading into Scala
Railroading into Scala
Nehal Shah511 views
Modern Compiler Design by nextlib
Modern Compiler DesignModern Compiler Design
Modern Compiler Design
nextlib997 views
Basic Operator, String and Characters in Swift. by HSIEH CHING-FAN
Basic Operator, String and Characters in Swift.Basic Operator, String and Characters in Swift.
Basic Operator, String and Characters in Swift.
HSIEH CHING-FAN540 views
Functional Programming #FTW by Adriano Bonat
Functional Programming #FTWFunctional Programming #FTW
Functional Programming #FTW
Adriano Bonat1K views
Денис Лебедев, Swift by Yandex
Денис Лебедев, SwiftДенис Лебедев, Swift
Денис Лебедев, Swift
Yandex1.1K views
Dynamic Type Inference for Gradual Hindley–Milner Typing by Yusuke Miyazaki
Dynamic Type Inference for Gradual Hindley–Milner TypingDynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner Typing
Yusuke Miyazaki685 views
Programming Languages: some news for the last N years by Ruslan Shevchenko
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
Ruslan Shevchenko1.2K views
Swift Optional ?? by Chihyang Li
Swift Optional ??Swift Optional ??
Swift Optional ??
Chihyang Li122 views
Java Tutorial Lab 2 by Berk Soysal
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
Berk Soysal3.1K views

Viewers also liked

Always bet on JS - Finjs.io NYC 2016 by
Always bet on JS - Finjs.io NYC 2016Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016Brendan Eich
1.9K views48 slides
meetup adopting java8 by
meetup adopting java8meetup adopting java8
meetup adopting java8Filipe Portes
548 views19 slides
Resultaten serious game who is john galt by
Resultaten serious game who is john galtResultaten serious game who is john galt
Resultaten serious game who is john galtRob Oostdam
699 views21 slides
The Street Kids of Calabar: A Punitive Approach is Not Enough by
 The Street Kids of Calabar: A Punitive Approach is Not Enough The Street Kids of Calabar: A Punitive Approach is Not Enough
The Street Kids of Calabar: A Punitive Approach is Not EnoughPIND Foundation
580 views4 slides
SAPI Solutions for Distribution by
SAPI Solutions for DistributionSAPI Solutions for Distribution
SAPI Solutions for DistributionEric Thornell
401 views1 slide
Client-Side Performance Monitoring (MobileTea, Rome) by
Client-Side Performance Monitoring (MobileTea, Rome)Client-Side Performance Monitoring (MobileTea, Rome)
Client-Side Performance Monitoring (MobileTea, Rome)Andrew Rota
398 views96 slides

Viewers also liked(18)

Always bet on JS - Finjs.io NYC 2016 by Brendan Eich
Always bet on JS - Finjs.io NYC 2016Always bet on JS - Finjs.io NYC 2016
Always bet on JS - Finjs.io NYC 2016
Brendan Eich1.9K views
Resultaten serious game who is john galt by Rob Oostdam
Resultaten serious game who is john galtResultaten serious game who is john galt
Resultaten serious game who is john galt
Rob Oostdam699 views
The Street Kids of Calabar: A Punitive Approach is Not Enough by PIND Foundation
 The Street Kids of Calabar: A Punitive Approach is Not Enough The Street Kids of Calabar: A Punitive Approach is Not Enough
The Street Kids of Calabar: A Punitive Approach is Not Enough
PIND Foundation580 views
SAPI Solutions for Distribution by Eric Thornell
SAPI Solutions for DistributionSAPI Solutions for Distribution
SAPI Solutions for Distribution
Eric Thornell401 views
Client-Side Performance Monitoring (MobileTea, Rome) by Andrew Rota
Client-Side Performance Monitoring (MobileTea, Rome)Client-Side Performance Monitoring (MobileTea, Rome)
Client-Side Performance Monitoring (MobileTea, Rome)
Andrew Rota398 views
Doctor, Lawyer, Poker Player, Physicist: The Best Engineers We're Not Competi... by Carina C. Zona
Doctor, Lawyer, Poker Player, Physicist: The Best Engineers We're Not Competi...Doctor, Lawyer, Poker Player, Physicist: The Best Engineers We're Not Competi...
Doctor, Lawyer, Poker Player, Physicist: The Best Engineers We're Not Competi...
Carina C. Zona1.2K views
Iapmei incentivos industria 4.0 apt v4 by Pedro Cilínio
Iapmei   incentivos industria 4.0 apt v4Iapmei   incentivos industria 4.0 apt v4
Iapmei incentivos industria 4.0 apt v4
Pedro Cilínio506 views
Onde é que nos encontramos para aonde estamos a ir e onde devemos estar by Jorge Moreira
Onde é que nos encontramos para aonde estamos a ir e onde devemos estarOnde é que nos encontramos para aonde estamos a ir e onde devemos estar
Onde é que nos encontramos para aonde estamos a ir e onde devemos estar
Jorge Moreira927 views
専修大学文学部50年小史 by LettersSU
専修大学文学部50年小史専修大学文学部50年小史
専修大学文学部50年小史
LettersSU2.4K views
25 Quotes to Inspire your Operational Excellence Initiatives by Carla Gregory
25 Quotes to Inspire your Operational Excellence Initiatives25 Quotes to Inspire your Operational Excellence Initiatives
25 Quotes to Inspire your Operational Excellence Initiatives
Carla Gregory10.4K views
Node.JS error handling best practices by Yoni Goldberg
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
Yoni Goldberg13.7K views

Similar to Int64

2 BytesC++ course_2014_c1_basicsc++ by
2 BytesC++ course_2014_c1_basicsc++2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++kinan keshkeh
140 views105 slides
Cs1123 11 pointers by
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointersTAlha MAlik
260 views51 slides
Cs1123 3 c++ overview by
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overviewTAlha MAlik
1.8K views51 slides
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013 by
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013midnite_runr
8.7K views72 slides
Lecture 2 by
Lecture 2Lecture 2
Lecture 2marvellous2
131 views29 slides
Math with .NET for you and Azure by
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and AzureMarco Parenzan
59 views29 slides

Similar to Int64(20)

2 BytesC++ course_2014_c1_basicsc++ by kinan keshkeh
2 BytesC++ course_2014_c1_basicsc++2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++
kinan keshkeh140 views
Cs1123 11 pointers by TAlha MAlik
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointers
TAlha MAlik260 views
Cs1123 3 c++ overview by TAlha MAlik
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
TAlha MAlik1.8K views
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013 by midnite_runr
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
midnite_runr8.7K views
Math with .NET for you and Azure by Marco Parenzan
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and Azure
Marco Parenzan59 views
Programming in C [Module One] by Abhishek Sinha
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
Abhishek Sinha561 views
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx by Marco Parenzan
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Marco Parenzan10 views
C language Unit 2 Slides, UPTU C language by Rakesh Roshan
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
Rakesh Roshan5.7K views
AVR_Course_Day3 c programming by Mohamed Ali
AVR_Course_Day3 c programmingAVR_Course_Day3 c programming
AVR_Course_Day3 c programming
Mohamed Ali1.4K views
Return of c++ by Yongwei Wu
Return of c++Return of c++
Return of c++
Yongwei Wu1.1K views
02 functions, variables, basic input and output of c++ by Manzoor ALam
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
Manzoor ALam920 views

More from Brendan Eich

dotJS 2015 by
dotJS 2015dotJS 2015
dotJS 2015Brendan Eich
5.3K views27 slides
Fluent15 by
Fluent15Fluent15
Fluent15Brendan Eich
8.1K views15 slides
The Same-Origin Saga by
The Same-Origin SagaThe Same-Origin Saga
The Same-Origin SagaBrendan Eich
2.9K views15 slides
Taysom seminar by
Taysom seminarTaysom seminar
Taysom seminarBrendan Eich
7.5K views7 slides
My dotJS Talk by
My dotJS TalkMy dotJS Talk
My dotJS TalkBrendan Eich
10.6K views31 slides
Mozilla Research Party Talk by
Mozilla Research Party TalkMozilla Research Party Talk
Mozilla Research Party TalkBrendan Eich
3.1K views33 slides

More from Brendan Eich(16)

Recently uploaded

Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Marc Müller
37 views83 slides
The Era of Large Language Models.pptx by
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
5 views9 slides
Short_Story_PPT.pdf by
Short_Story_PPT.pdfShort_Story_PPT.pdf
Short_Story_PPT.pdfutkarshsatishkumarsh
5 views16 slides
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
5 views49 slides
Generic or specific? Making sensible software design decisions by
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
6 views60 slides
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...Deltares
9 views24 slides

Recently uploaded(20)

Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller37 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares9 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
Advanced API Mocking Techniques by Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy13 views
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme... by Deltares
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...
Deltares5 views
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller38 views
Copilot Prompting Toolkit_All Resources.pdf by Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana8 views
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols by Deltares
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - DolsDSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
Deltares7 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin95 views
DSD-INT 2023 The Danube Hazardous Substances Model - Kovacs by Deltares
DSD-INT 2023 The Danube Hazardous Substances Model - KovacsDSD-INT 2023 The Danube Hazardous Substances Model - Kovacs
DSD-INT 2023 The Danube Hazardous Substances Model - Kovacs
Deltares8 views
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
Dapr Unleashed: Accelerating Microservice Development by Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski10 views

Int64

  • 2. Brendan Eich Brave Software @BrendanEich Always bet on JS There are only two kinds of languages: the ones people complain about and the ones nobody uses. — Bjarne Stroustrup
  • 3. Always bet on Brendan Eich Brave Software @ BrendanEich JS Previous value/operator/suffix thinking… • Int64(0) ==> 0L // as in C# • Uint64(0) ==> 0UL // ditto • Float32(0) ==> 0f // ditto • BigInt(0) ==> 0N // N to avoid i/I • Decimal(0) ==> 0m // m or M, C/F# • User-defined suffixes and operators: | ^ & == < <= << >> >>> + - * / % ~ ToBoolean unary- unary+
  • 4. Always bet on Brendan Eich Brave Software @ BrendanEich JS Time passed, SIMD faded, new plan needed • Old plan was to build on SIMD landing in living spec.html • I hoped we would get more general “value type” semantics that way • But time matters; as Waldemar said in July, “we should just do Int64” • And @mikeal and I said exact same thing to each other in September • Insight: inducting from hardcoded Int64/Uint64 (with future-proofing) is strictly better than chained risk and complexity of layering on SIMD • This slide deck presents the status quo and sketches future proofs
  • 5. Always bet on Brendan Eich Brave Software @ BrendanEich JS The @littledan / @brendan BBQ design • After a BBQ joint after-meeting in January 2016 near PayPal, @littledan and I worked out (written up via Twitter DM) a better direct (no SIMD) plan, which is worth a recap for its constraints • We agreed on no implicit conversions, so binary operator dispatch needs no new magic: runtime semantics throw rather than convert so both operands have same Type • Unary operators could be single-dispatch or 1-ary functions • Literals and operators are separate proposals, details mostly TBD
  • 6. Always bet on Brendan Eich Brave Software @ BrendanEich JS Notable future-proofing problem: ToBoolean • Int64 and Uint64 zero values must be “falsy”, while SIMD all-zero vectors are truthy • Old sketch had ToBoolean operator on deck, but it would have to be infallible, or optimizations suffer fatally (per Andreas Rossberg) • New future-proof idea: numeric types (“value types”) declare their canonical zero value (arithmetic identity; one of N in “zero cohort”) • Bonus: also requiring numeric types to declare canonical unit (one, multiplicative identity) wins for ++/— consistency and simplicity
  • 7. Always bet on Brendan Eich Brave Software @ BrendanEich JS Consequences/examples for Int64 usage • 1L + 2L // 3L • let x = 4; console.log(x * 5L) // TypeError • console.log(Int64(x) * 5L) // 20L • 0x1FFFFFFFFFFUL * 2L // TypeError • 0x1FFFFFFFFFFUL * 2UL // OK • 0x1FFFFFFFFFFUL * Uint64(scale) // also OK
  • 8. Always bet on Brendan Eich Brave Software @ BrendanEich JS Spec.html plan of attack and status • Split “6.1.6 The Number Type” into subclauses of new Numeric Types clause for Number, Int64, and Uint64 • Split “20.1 Number Objects” into subclauses of new Numeric Objects clause for Number, Int64, and Uint64 constructors/prototypes/etc. • Check all ToNumber uses to see which ones should be ToNumeric • Refactor 12 Expressions semantics to delegate to Type(x)::op (see next) • Revise Number uses such as SameValueNonNumber carefully (in that case to be SameValueNonNumeric)
  • 12. Always bet on Brendan Eich Brave Software @ BrendanEich JS Future possible “value class” syntax • value class Decimal {
 constructor(x) {…}
 static zero = Decimal(0);
 static unit = Decimal(1);
 static [Symbol.unaryMinus](x) {…}
 static [Symbol.bitwiseNOT](x) {…}
 // etc…
 static [Symbol.add](x, y) {…}
 static [Symbol.subtract](x, y) {…}
 // etc…
 }
  • 13. Always bet on Brendan Eich Brave Software @ BrendanEich JS Future possible literal suffix support • value class Decimal {
 suffix m = fromLiteral;
 suffix M = fromLiteral;
 
 static fromLiteral(s) {…} // may throw
 
 // etc…
 }
 let three = 3M; // m and M in scope too • Question: allow RegExp for early error on invalid literal?
  • 14. Always bet on Brendan Eich Brave Software @ BrendanEich JS Regular expressions for early errors? • /(d{1,19}|
 17d{18}|
 18[0-3]d{17}|
 184[0-3]d{16}|
 1844[0-5]d{15}|
 ...
 18446744073709551615)
 UL/ • Very ugly, hard to handle other radixes, etc. Just say no! Let user- defined numeric types’ literals throw at runtime if malformed
  • 15. Brendan Eich Brave Software @BrendanEich Always bet on JS Spec Tour
  • 16. Always bet on Brendan Eich Brave Software @ BrendanEich JS Feedback requests and next steps • Publish a browsable modified spec via brendaneich.github.io
 (may move to tc39.github.io - stay tuned on Twitter!) • Auto-generate an ins/del version of https://github.com/brendaneich/ ecma262/spec.html and publish via gh-pages • Finish “20.1 Numeric Objects” spec changes • Incorporate feedback on detailed changes in published spec
 e.g., known bugs on 0L / 0L, 2L ** -3L, etc. to fix • Propose operators and (separate, later) suffixes/value classes