arturo-lang / arturo

Simple, expressive & portable programming language for efficient scripting
http://arturo-lang.io
MIT License
695 stars 30 forks source link

[Paths\module] Re-implement & change behavior of built-in function #1303

Closed github-actions[bot] closed 9 months ago

github-actions[bot] commented 9 months ago

[Paths\module] Re-implement & change behavior of built-in function

This should actually check if the aforementioned module/package is installed first.

If not, it should look it up - and if available online - download it and install it.

This obviously goes hand-in-hand with the development & implementation of Arturo's new package manager.

builtin "module", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "get path for given module name", args = { "name" : {String,Literal} }, attrs = NoAttrs, returns = {String,Null}, example = """ print module 'html ; /usr/local/lib/arturo/html.art .......... do module 'html ; (imports given module) """:

=======================================================

when defined(windows): push(newString(HomeDir & ".arturo\lib\" & x.s & ".art")) else: push(newString(HomeDir & ".arturo/lib/" & x.s & ".art"))

https://github.com/arturo-lang/arturo/blob/21531d4ec0cfe7a67b0fa3d88a44ff1a8a0473b4/src/library/Paths.nim#L244

                push(newStringBlock(contents))

        # # TODO(Paths\module) Re-implement & change behavior of built-in function
        # #  This should actually check if the aforementioned module/package is installed first.
        # #  If not, it should look it up - and if available online - download it and install it.
        # #  This obviously goes hand-in-hand with the development & implementation of Arturo's new package manager.
        # #  labels: library, package manager, enhancement
        # builtin "module",
        #     alias       = unaliased, 
        #     op          = opNop,
        #     rule        = PrefixPrecedence,
        #     description = "get path for given module name",
        #     args        = {
        #         "name"  : {String,Literal}
        #     },
        #     attrs       = NoAttrs,
        #     returns     = {String,Null},
        #     example     = """
        #     print module 'html        ; /usr/local/lib/arturo/html.art
        #     ..........
        #     do module 'html    ; (imports given module)
        #     """:
        #         #=======================================================
        #         when defined(windows):
        #             push(newString(HomeDir & ".arturo\\lib\\" & x.s & ".art"))
        #         else:
        #             push(newString(HomeDir & ".arturo/lib/" & x.s & ".art"))

        builtin "normalize",
            alias       = unaliased, 
ndex 940f24da4e..15898263cf 100644
++ b/src/scripts/console.art

6411b1fcd9273cdc87ced0abf16758ab822798f9

github-actions[bot] commented 9 months ago

Closed in a85dfa02f22d394719cf3f7930e2a9e64c8bed21