Document typecasting - #424
Open
miharp wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the missing “Typecasting” documentation page to the OpenVox 8.x language docs, closing the remaining data-type documentation gap tracked in #407 by describing explicit value conversion patterns and linking into the generated new() reference.
Changes:
- Added a new
lang_typecasting.mdpage documenting common conversions (constructor-style calls, number/string/boolean/array/hash conversions,scanf, and strictness-related coercion behavior). - Added a cross-link from the “About values and data types” page to the new Typecasting page.
- Added a sidebar navigation entry for the new Typecasting page.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/_openvox_8x/lang_typecasting.md | New documentation page covering explicit type conversions and coercion notes. |
| docs/_openvox_8x/lang_data.md | Adds a pointer from the data overview to the new Typecasting page. |
| _data/nav/openvox_8x.yml | Adds the Typecasting entry to the OpenVox 8.x navigation sidebar. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The language collection had no page covering conversion between data
types. Add lang_typecasting.md, covering calling a data type as a
constructor, conversion to numbers, strings, booleans, arrays and
hashes, extracting numbers with scanf, and automatic coercion in
arithmetic.
Every example is verified against OpenVox 8.28.1 with puppet apply.
Two behaviors documented here differ from what the upstream new()
docstring and the Puppet Core typecasting page describe:
* The docstring gives Float.new and Numeric.new an $abs default of
true; at runtime the default is false, so Numeric('-42.3') returns
-42.3 rather than 42.3.
* Automatic string-to-number coercion in arithmetic is an error by
default, because the strict setting defaults to error. The page
shows explicit conversion instead of relaxing the setting.
Conversion is described as something you ask for rather than something
Puppet never does, since arithmetic coerces strings to numbers when
strict is not error, and interpolation converts any value to a string
even under strict=error. Both exceptions are signposted from the top of
the page.
Part of OpenVoxProject#407
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Michael Harp <mike@mikeharp.com>
The section documents both arithmetic coercion and string interpolation, but the heading named only arithmetic, so the pointer from the top of the page under-described where it led. Drop the qualifier and update the in-page link. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
miharp
force-pushed
the
docs/lang-typecasting-407
branch
from
July 27, 2026 11:14
2525571 to
b410edf
Compare
The Integer section said the radix applies when converting a string, but the absolute-value example passed an Integer with a radix of 10, which reads as inconsistent. Integer has a single positional dispatch, (from, radix, abs), where the radix is typed Variant[Default, Integer[2,2], Integer[8,8], Integer[10,10], Integer[16,16]]. A Boolean cannot occupy that slot, so Integer(-38, true) is an argument-mismatch error and the radix must be supplied to reach the third argument even when it does not apply. The upstream new() docstring advertises a two-argument Integer.new(Variant[Numeric, Boolean], Boolean) overload that the dispatch does not implement. Keep a working example, add a string case where the radix genuinely applies, and use default as the placeholder for non-string input. Say positionally why the argument is there. Verified against OpenVox 8.28.1 with puppet apply. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a page covering conversion between data types, the last of the missing pages identified in #407.
The language collection had nothing explaining how to turn a value of one type into a value of another. The page covers:
newfunction, positional and named arguments, and how constrained types such asInteger[0]check the resultTuple/StructvariantsscanfstrictIt links into the generated
function.html#newreference rather than restating every conversion signature.The page is wired into
_data/nav/openvox_8x.ymland the index inlang_data.md.Verification
puppet apply: 60 value assertions checked against their stated output, plus 6 error cases. The three error messages quoted in the page match the runtime text verbatim.markdownlint-cli2reports no issues.bundle exec jekyll buildis clean, andrake test:linkspasses across 455 files, including the#automatic-coercion-in-arithmeticanchor.Two behaviors documented here differ from the upstream
new()docstring and the Puppet Core typecasting page, so they are worth a reviewer's attention:Float.newandNumeric.newan$absdefault oftrue. At runtime the default isfalse, soNumeric('-42.3')returns-42.3rather than42.3. The page documents the runtime behavior.strictdefaults toerror. The page shows explicit conversion rather than suggesting the setting be relaxed.The page describes conversion as something you ask for rather than something Puppet never does, because two exceptions are real: arithmetic coerces strings to numbers when
strictis noterror, and interpolation converts any value to a string even understrict=error. Both are signposted from the top of the page.Content is original prose in the existing
lang_*house style. help.puppet.com was used as a coverage reference only, not copied.Part of #407