arturo icon indicating copy to clipboard operation
arturo copied to clipboard

[Converters\from] add documentation example for `.opcode`

Open github-actions[bot] opened this issue 2 years ago • 0 comments

[Converters\from] add documentation example for .opcode

https://github.com/arturo-lang/arturo/blob/65e1cf749c1d12727a29db43e2777c75bd17178b/src/library/Converters.nim#L842


    # TODO(Converters\from) Do we really need this?
    #  We can definitely support hex/binary literals, but how would we support string to number conversion? Perhaps, with `.to` and option?
    #  It's basically rather confusing...
    #  labels: library, cleanup, enhancement, open discussion
    builtin "from",
        alias       = unaliased, 
        rule        = PrefixPrecedence,
        description = "get value from string, using given representation",
        args        = {
            "value" : {String,Literal}
        },
        attrs       = {
            "binary"    : ({Logical},"get integer from binary representation"),
            "hex"       : ({Logical},"get integer from hexadecimal representation"),
            "octal"     : ({Logical},"get integer from octal representation"),
            "opcode"    : ({Logical},"get opcode by from opcode literal")
        },
        returns     = {Any},
        # TODO(Converters\from) add documentation example for `.opcode`
        #  labels: library, documentation, easy
        example     = """
            print from.binary "1011"        ; 11
            print from.octal "1011"         ; 521

9e691ba261c01118fc98812a471f5fc7831b8d31

github-actions[bot] avatar Aug 17 '22 16:08 github-actions[bot]