we (web engine): Experimental web browser project to understand the limits of Claude

JS Built-in: String, Number, Boolean, Symbol #98

open opened by pierrelf.com

Implement the primitive wrapper built-ins: String, Number, Boolean, and Symbol.

Scope#

String#

  • String() constructor and primitive coercion
  • String.fromCharCode(), String.fromCodePoint()
  • Instance properties: length
  • Prototype methods: charAt, charCodeAt, codePointAt
  • concat, slice, substring, substr
  • indexOf, lastIndexOf, includes, startsWith, endsWith
  • trim, trimStart, trimEnd
  • padStart, padEnd
  • repeat
  • split, replace, replaceAll (string pattern — RegExp patterns in RegExp issue)
  • toLowerCase, toUpperCase
  • at, match, search (basic string patterns)
  • toString, valueOf
  • String iteration (for...of over code points)

Number#

  • Number() constructor and primitive coercion
  • Number.isNaN(), Number.isFinite(), Number.isInteger(), Number.isSafeInteger()
  • Number.parseInt(), Number.parseFloat()
  • Number.EPSILON, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MAX_VALUE, Number.MIN_VALUE, NaN, Infinity
  • Prototype: toString(radix), toFixed(digits), toPrecision(precision), toExponential(digits), valueOf()
  • Global parseInt(), parseFloat(), isNaN(), isFinite()

Boolean#

  • Boolean() constructor and truthiness coercion
  • Boolean.prototype.toString(), Boolean.prototype.valueOf()

Symbol#

  • Symbol(description) factory (not constructable with new)
  • Symbol.for(key) and Symbol.keyFor(sym) (global symbol registry)
  • Well-known symbols: Symbol.iterator, Symbol.toPrimitive, Symbol.toStringTag, Symbol.hasInstance
  • Symbol.prototype.toString(), Symbol.prototype.description
  • Symbols as property keys

Acceptance Criteria#

  • String methods produce correct results (test each)
  • Number parsing and formatting work correctly
  • Boolean coercion follows truthiness rules
  • Symbol creation and global registry work
  • Well-known symbols are defined
  • Primitive auto-boxing works (e.g., "hello".length)
  • Unit tests for each method

Phase 10 — JavaScript Engine (issue 9 of 15). Depends on: JS core built-ins (Object/Function/Array/Error).

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mhn3nbv6wd2e