Skip to content

feat: DSL standard library — §8.7 physical-object actors (p7-s5) - #97

Merged
JArmandoAnaya merged 2 commits into
mainfrom
feat/p7-s5-stdlib-entities
Aug 2, 2026
Merged

JArmandoAnaya merged 2 commits into
mainfrom
feat/p7-s5-stdlib-entities

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

Second of the stacked PRs for #43, on top of #96. It opens
osc.standard.domain (namespace std) with the physical-object actors of §8.7.

What lands

The entity model: the osc_actor → physical_object → movable_object →
traffic_participant → vehicle → trailer inheritance chain, plus
stationary_object, person and animal; the bounding_box, axle,
hitch_receiver and hitch_coupler structs; all eleven §8.7 enumerations; and
the §8.7.6.1 measurement methods (time_to_collision, time_gap, space_gap,
time_headway, space_headway).

osc.standard.all and the legacy osc.standard now bring both sub-modules.
osc.standard.domain pulls the types sub-module along with it, because the
domain model is written in its physical types — §7.7.5.1's import-once rule
makes the duplicate reference free.

Reading a specification that stopped printing code

§8.14 gave the library as DSL code blocks. From §8.7 onward the standard prints
parameter tables instead, so each declaration is a translation rather than a
transcription. Three judgement calls, all recorded in the source and the README:

  • A table row is a field, whether the standard calls it a parameter or a
    state variable, and whether or not it is marked mandatory. The language has no
    optional-field marker, and §7.3.11 already lets a scenario leave a field
    unconstrained, so nothing is lost by declaring them uniformly.
  • An actor's modifier uses the prefixed form. §8.7.4.1.1 writes
    stationary_object.location(), which is modifier stationary_object.location
    — not modifier location of stationary_object, because §7.3.12.2's of
    names a scenario or an action. The resolver caught this: it was the only thing
    the first draft of the module got wrong.
  • §8.7.26 is out. The standard marks traffic-participant groups
    non-normative, so they are not part of the library.

The backward-compatibility spellings the standard keeps (truck = heavy_truck,
vru_vehicle = micro_mobility_device, fire = fire_brigade,
road_assistance = roadside_assistance, road_construction = construction) map
onto §7.2.2.2.2's = other_member form exactly, and a test asserts each legacy
name really does carry its replacement's value.

Deferred, deliberately

The road-dependent physical_object methods — road_distance,
distance_to_route_point, get_s_coord, get_route_point,
distance_along_route, … — need §8.12's route, route_point, xyz_point and
odr_point. They arrive with the §8.12 slice as extend physical_object:
blocks, which is precisely how the standard prints their prototypes. set_bm
waits on §8.6's behavioral_model the same way.

Tests

1235 → 1246 gtest. Eleven new cases in dsl_stdlib_test.cpp, led by
TheDomainSubModuleChecksClean — the library loads through
import osc.standard.all with zero diagnostics of any severity, which is
half of p7-s5's exit criterion. ImportingTheStandardLibraryTwiceLoadsItOnce
now names all four module references and still ends with exactly two library
files.

Local gate green: build, 1246/1246 ctest, 184 pytest, format.sh --check,
check_detmath.sh, check_coverage_matrix.py.

Refs #43

Adds osc.standard.domain (namespace std) and its first chapter: the
physical-object actors of §8.7, with their structs and enumerations.

- The osc_actor → physical_object → movable_object → traffic_participant
  → vehicle → trailer inheritance chain, plus stationary_object, person
  and animal; bounding_box, axle, hitch_receiver, hitch_coupler; all 11
  §8.7 enums, including the backward-compatibility spellings that the
  standard keeps equal to their replacements; the §8.7.6.1 measurement
  methods.
- osc.standard.all and the legacy osc.standard now bring both sub-modules;
  osc.standard.domain pulls the types sub-module with it, since the domain
  model is written in its physical types.
- §8.7 is printed as parameter tables, not as code. A row is declared as a
  field whether the standard calls it a parameter or a state variable and
  whether or not it is mandatory — the language has no optional-field
  marker, and §7.3.11 already lets a scenario leave a field unconstrained.
- §8.7.26 (traffic-participant groups) is explicitly non-normative and is
  not part of the library.

The road-dependent physical_object methods are deferred to the §8.12 slice
and will arrive as extend blocks, which is how the standard prints their
prototypes.

Refs #43
Windows CI caught it: 'file://' + 'C:/x/y.osc' reads the drive letter as
the URI authority, so an import of an existing file was rejected as naming
a host. §7.7.5.1.1's own examples spell the path 'file:///c:/Users/...',
'file:/c:/Users/...' and '/c:/Users/...' — the slash in front of the drive
letter is URI syntax, not part of the path, and dropping it is what makes
the reference absolute rather than relative to the current drive.

The URI test now builds a spec-shaped reference and exercises all three
spellings; a new case pins that a genuine authority is still rejected.

Refs #43
@JArmandoAnaya
JArmandoAnaya merged commit 56edfbf into main Aug 2, 2026
12 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/p7-s5-stdlib-entities branch August 2, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant