Language reference

Data types

Current Sun runtime classes and the roadmap toward MATLAB-compatible typed arrays.

01

Current runtime classes

Sun currently stores real scalars, complex scalars, and dense numeric matrices as MATLAB-compatible double values. Logical and string values are scalar-only, and runtime exceptions use the SunException class.

  • double: real scalars, complex scalars, and dense f64 matrices
  • logical: boolean scalars
  • string: UTF-8 text scalars
  • SunException: caught runtime exceptions
02

Identify a value

class returns the exact runtime class. isa accepts exact names and the MATLAB numeric categories numeric, float, and integer.

Sun
disp(class(3.5));              % double
disp(class(true));             % logical
disp(isa([1, 2], "numeric")); % true
disp(isa(1, "integer"));     % false
03

Convert to double

double preserves real, complex, and matrix values and converts logical scalars to 0 or 1. Text conversion is intentionally deferred because Sun does not yet distinguish character arrays from string arrays.

Sun
value = double(true);
disp(value);         % 1
disp(class(value));  % double
04

MATLAB type roadmap

  • Typed dense arrays for logical, single, half, and signed or unsigned integers
  • Separate character arrays and string arrays
  • Dates, durations, and categorical arrays
  • Cells, structures, tables, and timetables
  • Function handles, dictionaries, and time series
Support boundary

New numeric types must share an array storage model. Scalar-only single or integer variants would not provide sound matrix semantics, promotion rules, indexing, debugger output, or Studio serialization.