Skip to content

undefined ID within obj_accessor() has carve-out #10

@jon-gilbert

Description

@jon-gilbert

https://github.com/jon-gilbert/openscad_objects/blob/main/object_common_functions.scad#L781-L783

        : (!_defined(id))
            ? default
            : _first([obj[id], default, toc_default, undef]);

It's not clear under what conditions an undefined id here would be supportable.

There is a specific test for this case:
https://github.com/jon-gilbert/openscad_objects/blob/main/tests/test_03_object.scad#L194-L196

    // test to see if we can successfully get back nothing with an undefined object
    o6 = undef;
    assert( obj_accessor(o6, "string", default="default") == "default" );

...but no indication WHY. It may have been a consistency thing (all values callable via obj_accessor(), even when there's no actual object), or a precursor based on default values, but I can't imagine this being used in either of these ways.

  • revert this behavior - it is already disabled from within issue-9
  • make sure nothing else depends on this behavior within 507
  • remove this behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions