Internal Specifier/Alias Referencing Issues

Summary

I have been developing some personal Util modules for production efficiency and recently got into Scenegraph development. I saw an annoying syntax with the SpatialMath that always required specifying if it is (/Verse.org/SpatialMath:) or (/UnrealEngine.com/Temporary/SpatialMath:). I thought to utilize Alias for that so I can reference vector3 without having to always copy paste the specific SpatialMath library.

In my utils module that handles vector math I have these two alias:

VectorMathModule<public> := module:
    luf_vector3<public> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<public> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3

I was making various SceneGraph module helper functions. When I started creating the functions and utilized luf_vector3 or xyz_vector3, I was having issues doing the basic of references.

using { VectorMathModule }
SceneGraphModule<public> := module:
    ExampleFunc(SimpleVector : xyz_vector3):void=
        Print("{SimpleVector}")

I tried doing a redundant fix where I copy paste the two alias as <internal> alias in the module but that did not work either.

When using <internal> in both modules, I get the following error: Ambiguous identifier;(VectorMathModule :)xyz_vector3 or (SceneGraphModule:)xyz_vector3

If I use <public> specifier and only have the alias in VectorMathModule, SceneGraphModule functions tell me that luf_vector3 or xyz_vector3: Can't access a type alias from a preceding expression.(3502).

The directory setup I have is

Utility
    vector_math_utility.verse (VectorMathModule stored here)
    scene_graph_utility.verse (SceneGraphModule stored here)

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

Do one of the following setups

Module1<public> := module:
    luf_vector3<public> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<public> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3
# --------------------------------------- #
using . Module1
Module2<public> := module:
    ExampleFunction(VectorParameter : xyz_vector3):void={}
Module1<public> := module:
    luf_vector3<internal> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<internal> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3
# --------------------------------------- #
using . Module1

Module2<public> := module:
    luf_vector3<internal> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<internal> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3

    ExampleFunction(VectorParameter : xyz_vector3):void={}

Directory Setup

Utils
  module1_utils.verse
  module2_utils.verse

Expected Result

ExampleFunction() should be able to easily use xyz_vector3 or luf_vector3 in a different module with ease.

Observed Result

Neither methods seemed to have worked without resulting in error messages.

This results in Can't access a type alias from a preceding expression.(3502)

Module1<public> := module:
    luf_vector3<public> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<public> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3
# --------------------------------------- #
using . Module1
Module2<public> := module:
    ExampleFunction(VectorParameter : xyz_vector3):void={}

This results in Ambiguous identifier;(Module1:)xyz_vector3 or (Module2:)xyz_vector3

Module1<public> := module:
    luf_vector3<internal> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<internal> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3
# --------------------------------------- #
using . Module1

Module2<public> := module:
    luf_vector3<internal> := (/Verse.org/SpatialMath:)vector3
    xyz_vector3<internal> := (/UnrealEngine.com/Temporary/SpatialMath:)vector3

    ExampleFunction(VectorParameter : xyz_vector3):void={}

Directory Setup

Utils
  module1_utils.verse
  module2_utils.verse

Platform(s)

windows

If i understand correctly you need all/part of these

Converts Verse<>UnrealEngine coords

(FRUVector3:(/UnrealEngine.com/Temporary/SpatialMath:)vector3).Convert():(/Verse.org/SpatialMath:)vector3 =
(/UnrealEngine.com/Temporary/SpatialMath:)FromVector3(FRUVector3)

(FRUTransform:(/UnrealEngine.com/Temporary/SpatialMath:)transform).Convert():(/Verse.org/SpatialMath:)transform =
(/UnrealEngine.com/Temporary/SpatialMath:)FromTransform(FRUTransform)

(FRURotation:(/UnrealEngine.com/Temporary/SpatialMath:)rotation).Convert():(/Verse.org/SpatialMath:)rotation =
(/UnrealEngine.com/Temporary/SpatialMath:)FromRotation(FRURotation)

(LUFVector3:(/Verse.org/SpatialMath:)vector3).Convert():(/UnrealEngine.com/Temporary/SpatialMath:)vector3 =
(/UnrealEngine.com/Temporary/SpatialMath:)FromVector3(LUFVector3)

(LUFTransform:(/Verse.org/SpatialMath:)transform).Convert():(/UnrealEngine.com/Temporary/SpatialMath:)transform =
(/UnrealEngine.com/Temporary/SpatialMath:)FromTransform(LUFTransform)

(LUFRotation:(/Verse.org/SpatialMath:)rotation).Convert():(/UnrealEngine.com/Temporary/SpatialMath:)rotation =
(/UnrealEngine.com/Temporary/SpatialMath:)FromRotation(LUFRotation)

operator’+'(L:(/UnrealEngine.com/Temporary/SpatialMath:)vector3, R:(/Verse.org/SpatialMath:)vector3):(/UnrealEngine.com/Temporary/SpatialMath:)vector3 =
(L.Convert() + R).Convert()

Use like this…

NewEntity.SetGlobalTransform(FromTransform(BallOrigin.GetTransform()))

The FromTransform in this case converts ue to sg math

Also check in the ue digest i believe they have added a ton of useful helpers now as it was getting abit outta control

You can also specify which math module to use like the following syntax for example

Hope some of this helps

(post deleted by author)

I had to do the manual specification of which library but the whole goal of using those alias was to just be able to do vector3 without having the two library conflicts. So I created luf_vector3 and xyz_vector3. So when im creating parameters for a function or creating new variables. I want to be able to just use a simple type without having the long library as the prefix. My issue was not converting or anything. It is referencing a public alias from one module to another.

The library specifying for each time I use vector3 is too ugly. I wanted to use alias to make the code look cleaner. I did check in with Sabrina about this and she confirmed that it did seem like a bug and to make a bug report on it.