关于UTYPE的知识!在REBOL 3中? [英] What's known about UTYPE! in REBOL 3?

查看:76
本文介绍了关于UTYPE的知识!在REBOL 3中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以找到有关数据类型UTYPE的唯一信息!是尚未为R3记录的文档"和用户定义的数据类型",仍然给我带来了希望,我可以摆脱Rebol的预定义数据类型的规范,并以更直接的方式制定函数的多态性.只是...我不知道如何处理UTYPE!正在尝试:

The only information I can find on the datatype UTYPE! is "not yet been documented for R3" and "user defined datatype", still giving a shred of hope that I can break out of Rebol's canon of predefined datatypes and formulate the polymorphism of my functions in a more straightforward manner. Just... I've no idea how to deal with UTYPE!. Trying:

make utype! <2nd-arg>

带有多种参数(包括对象)的对象总是会导致脚本错误:无效的参数:< 2nd-arg>".

with several kinds of arguments (including an object) was invariably leading to "Script error: invalid argument: <2nd-arg>".

那么,如何使用它呢?是否完全实现了此功能?如果没有,是否有关于其工作方式的任何已知信息?

So, how to operate with it? Is this feature implemented at all? And if not, is there anything known about how it is intended to work?

顺便说一句,我很清楚可以通过类似以下的构造来模拟自制数据类型:

BTW, I'm well aware home brewed datatypes can be simulated by constructs like:

make object! [
    class: ...
    value: ...
]


补编,写于11月8日:

玩UTYPE!会产生帮助:

>> foo!: make utype! [[] [random: func [value] [42]]]
>> type? foo!
== utype!

>> ? echo
USAGE:
    ECHO target

DESCRIPTION:
    Copies console output to a file.
    ECHO is a native value.

ARGUMENTS:
REBOL System Error:
REBOL System Error #1224: assertion failed

Program terminated abnormally.
This should never happen.
Please contact www.REBOL.com with details.

(在Lion上为2.101.0.2.5).幕后肯定有事发生.

(2.101.0.2.5 on Lion). There was certainly something going on under the hood.

推荐答案

如果您在github上查看Rebol源代码(

If you view the Rebol source code on github (https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/t-utype.c) it is clear that this feature has not been built yet.

从文件标题中进行注释:

Comment from the header of the file:

**  Notes:   NOT IMPLEMENTED

通过curscode.org搜索将带回许多注释,这些注释显示了针对utype!数据类型的计划方向.

Searching through curecode.org brings back a number of comments which show the direction that is planned for the utype! datatype.

有一个计划添加用户定义的数据类型-我们甚至为此保留了一个内置类型utype!.这将使我们能够添加新的数据类型来响应动作,这将使我们在必要时甚至可以使它们支持数学运算.您唯一不会得到的是该类型的自定义(非构造)语法,或者能够容纳在值槽中的功能. -BrianH

There's a plan to add user-defined datatypes - we even have a built-in type reserved for this, utype!. This would allow us to add new datatypes which respond to the actions, which would allow us to even have them support math operations if necessary. The only thing you wouldn't get is custom (non-construction) syntax for the type, or the ability to fit in a value slot. - BrianH

来源: http://curecode.org/rebol3/ticket.rsp?id= 2137

这篇关于关于UTYPE的知识!在REBOL 3中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆