分享

Source - Function Summary

 gearss 2021-11-12

Source - Function Summary

Summary:

Prints the source code for a word.

Usage:

source word

Arguments:

word - The word argument. (must be: word) 

Description:

Displays the source code for a function by molding it in a formatted manner from the internal loaded block strucures. Only provides the source code to REBOL defined functions, not native (machine code) functions. 

This function is useful for learning how mezzanine (higher level) functions are defined. 

    source source

    source: func [

        "Prints the source code for a word." 

        'word [word!]][

        prin join word ": " 

        if not value? word [print "undefined" exit] 

        either any [native? get word op? get word action? get word] [

            print ["native" mold third get word]] [print mold get word]]

If the function specified is a native, SOURCE returns the function's argument specification. 

    source copy

    copy: native [

        "Returns a copy of a value." 

        value [series! port! bitset!] "Usually a series" 

        /part "Limits to a given length or position." 

        range [number! series! port! pair!] 

        /deep "Also copies series values within the block."

    ]

Related:

? - Prints information about words and values.

help - Prints information about words and values.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多