Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Low level details of Fuze Basic

    Help
    2
    4
    265
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BarenDK F last edited by

      Hi,

      Would it be possible to know some details about how Fuze Basic works below the surface.

      1. It would be great to know how functions with parameters work. I am wondering if parameters are passed by reference or by value. In particular strings and structs. I know I can do some tests to know this but I really think it should be in the documentation. However, I have not been able to find this info yet.

      2. It seems that numerical variables are represented as 32 bit floating point values by default. How can you ensure that integer variables stay integer and do not suddenly transition into floating point values when passed to a function or is updated in a mathematical operation. I try to make variables integers by writing 'x = int(0)'. I assume this will make the variable an integer below the surface but I am not sure. And then, what if I pass it to a function, will it then be converted into a float in that function. Example:

      x = int(0) // Is 'x' an integer here?
      x = f(x) // Is 'x' a float here?

      function f(d) return d

      1 Reply Last reply Reply Quote 0
      • M
        MikeDX last edited by

        it's probably worth mentioning that fuze isn't basic (it's very much a unique language with parts taken from many different languages)

        some function parameters are passed by value and others by reference. this needs documenting properly

        fuze is very loosely typed, there is a lot of forgiveness when it comes to values stored in strings, arrays, floats, ints and even structures

        hope this helps a little!

        1 Reply Last reply Reply Quote 1
        • B
          BarenDK F last edited by

          Thanks for your reply. Great that the documentation will be updated concerning function parameters.
          However, I am little concerned about the "loose" type handling. Apart from performance issues, floating point variables are not well suited for holding integer values. Strange results can occur, like 'x += 1 x -= 1' not necessarily resulting in 'x' returning to its old value because of the loss of integer precision in the floating point representation. Therefore, it would be nice if you could also document how and when the Fuze language decides to convert types, and also, how to avoid it, if possible.

          M 1 Reply Last reply Reply Quote 0
          • M
            MikeDX @BarenDK last edited by

            @BarenDK said in Low level details of Fuze Basic:

            floating point variables are not well suited for holding integer values. Strange results can occur, like 'x += 1 x -= 1'

            It's loosely typed meaning things are automatically casted at the point of any operation. we don't store ints as floats for the same reason we don't store strings as ints.

            There's no precision lost unless you cast things yourself to change the type too.

            Saying that, if you can find an example of it not working as it should, please let me know so I can raise an issue internally for a future patch

            1 Reply Last reply Reply Quote 0
            • First post
              Last post