Skip to content

[Types\to] :null-ish parameters should be optional when converting from :dictionary to :object #2187

@RickBarretto

Description

@RickBarretto

Summary

When converting :dictionary to :object, parameters that may be :null should be optional

Current Behavior

$> define :example [required :string optional :string :null]

$> inspect to :example #[required: "Some value" optional: "I'm here just because yes"]
[ :example
        required  :        Some value :string
        optional  :        I'm here just because yes :string
]

$> inspect to :example #[required: "Some value"]

══╡ Value Error ╞══════════════════════════════════════════════════════════════════════════════ <repl> ══

  Cannot initialize object of type: 
      :example

  Wrong number of parameters:
      1

  Expected:
      2 required, optional

Expected Behavior

$> define :example [required :string optional :string :null]

$> inspect to :example #[required: "Some value" optional: "I'm here just because yes"]
[ :example
        required  :        Some value :string
        optional  :        I'm here just because yes :string
]

$> inspect to :example #[required: "Some value"]
[ :example
        required  :        Some value :string
        optional  :        null :null
]

Steps To Reproduce

No response

OS

Windows 11

Version

arturo 0.10.0 Arizona Bark (amd64/windows)

Anything else?

Issue reported from official Arturo's VS Code extension.

  • VS Code: Visual Studio Code 1.109.3 / Extension: v0.9.1

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Labels

:dictionary:objectenhancementNew feature or requestoopType definitions & object-oriented aspects of Arturoopen discussionOpen discussion about features/ideas/suggestions→ Types

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions