Rhai v0.20.2 Release Notes

  • This version adds a number of convenience features:

    • ๐Ÿท Ability for a Dynamic to hold an i32 tag of arbitrary data

    • Simplifies dynamic properties access by falling back to an indexer (passing the name of the property as a string) when a property is not found.

    ๐Ÿ› Bug fixes

    • Propagation of constants held in a custom scope now works properly instead of always replacing by ().

    ๐Ÿ’ฅ Breaking changes

    • Engine::disable_doc_comments is removed because doc-comments are now placed under the metadata feature flag.
    • ๐Ÿšš Registering a custom syntax now only requires specifying whether the Scope is adjusted (i.e. whether variables are added or removed). There is no need to specify the number of variables added/removed.
    • ๐Ÿ”Œ Assigning to a property of a constant is now allowed and no longer raise an EvalAltResult::ErrorAssignmentToConstant error. This is to facilitate the Singleton pattern. Registered setter functions are automatically guarded against setters calling on constants and will continue to raise errors unless the pure attribute is present (for plugins).
    • If a property getter/setter is not found, an indexer with string index, if any, is tried.
    • The indexers API (Engine::register_indexer_XXX and Module::set_indexer_XXX) are now also exposed under no_index.

    ๐Ÿ†• New features

    • ๐Ÿท Each Dynamic value can now contain arbitrary data (type i32) in the form of a tag. This is to use up otherwise wasted space in the Dynamic type.
    • A new internal feature no_smartstring to turn off SmartString for those rare cases that it is needed.
    • DynamicReadLock and DynamicWriteLoc are exposed under internals.
    • ๐Ÿ‘ From< Shared< Locked<Dynamic> > > is added for Dynamic mapping directly to a shared value, together with support for Dynamic::from.
    • An indexer with string index acts as a fallback to a property getter/setter.

    โœจ Enhancements

    • ๐Ÿšš Registering a custom syntax now only requires specifying whether the Scope is adjusted (i.e. whether variables are added or removed). This allows more flexibility for cases where the number of new variables declared depends on internal logic.
    • ๐Ÿ”Œ Putting a pure attribute on a plugin property/index setter now enables it to be used on constants.