Supported Built-ins
Porffor provides implementations for the following built-in categories:Global Objects
- Primitive Constructors:
Number,String,Boolean,Symbol,BigInt - Error Objects:
Error,TypeError,RangeError,ReferenceError,SyntaxError,EvalError,URIError,AggregateError - Utility Functions:
parseInt,parseFloat,isNaN,isFinite,encodeURI,decodeURI,encodeURIComponent,decodeURIComponent
Collections
- Array - Arrays and array methods
- Object - Objects and object methods
- Set - Set collection
- Map - Map collection
- WeakSet - Weak set collection
- WeakMap - Weak map collection
- WeakRef - Weak references
Text Processing
Numbers & Dates
Binary Data
- ArrayBuffer - Raw binary data buffer
- SharedArrayBuffer - Shared memory buffer
- DataView - View for reading/writing buffers
- Typed Arrays:
Uint8Array,Int8Array,Uint8ClampedArray,Uint16Array,Int16Array,Uint32Array,Int32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array
Structured Data
- JSON - JSON parsing and serialization
- Promise - Asynchronous operations
Reflection
- Reflect - Reflection API
Other
- Function - Function constructor and methods
- Crypto - Cryptographic operations (limited)
- console - Console logging
Implementation Status
Most built-ins are fully implemented according to ECMAScript specifications. Some built-ins may have limitations:Fully Implemented
✅ Array methods (map, filter, reduce, etc.)✅ String methods (split, slice, indexOf, etc.)
✅ Object methods (keys, values, entries, etc.)
✅ Math functions
✅ Date operations
✅ RegExp with full pattern support
✅ Typed arrays
✅ JSON parse/stringify
Partially Implemented
⚠️ Promises (basic support)⚠️ Crypto (limited operations)
⚠️ Reflect (most operations supported)
Not Yet Implemented
❌ Proxy❌ Async/await
❌ Generators
❌ Internationalization (Intl)
Usage
All built-ins work exactly as you’d expect in standard JavaScript:ECMAScript Compliance
Porffor aims for ECMAScript 2023+ compliance for implemented features. Each built-in follows the specification closely:Performance
Built-ins are compiled to optimized WebAssembly:- Zero overhead: No interpreter, direct WebAssembly execution
- Specialized paths: Optimized for common types (numbers, strings)
- Memory efficient: Custom memory layouts for JavaScript types
- SIMD support: Vectorized operations where applicable
Performance Example
Type Handling
Porffor’s built-ins handle JavaScript’s dynamic types correctly:Error Handling
Built-ins throw standard JavaScript errors:Console API
Theconsole object provides logging functionality: