首页 \ 问答 \ R3如何使用脚本标题的Needs字段?(How does R3 use the Needs field of a script header? Is there any impact on namespaces?)

R3如何使用脚本标题的Needs字段?(How does R3 use the Needs field of a script header? Is there any impact on namespaces?)

我想知道R3在处理脚本标题的Needs字段时的行为以及它对字绑定有什么影响。

背景。 我目前正在尝试将一些R2脚本移植到R3以学习R3。 在R2中,脚本标题的Needs字段本质上只是文档,但我使用自定义函数来引用使脚本运行所需的脚本。

R3似乎本身调用了Needs引用的脚本,但绑定似乎与执行其他脚本不同。

例如,当%test-parent.r为:

REBOL [
    title: {test parent}
    needs: [%test-child.r]
]

parent: now
?? parent
?? child

和%test-child是:

REBOL [
    title: {test child}
]

child: now
?? child

R3 Alpha(Saphiron build 22-Feb-2013/11:09:25)返回:

>> do %test-parent.r
Script: "test parent" Version: none Date: none
child: 9-May-2013/22:51:52+10:00
parent: 9-May-2013/22:51:52+10:00
** Script error: child has no value
** Where: get ajoin case ?? catch either either -apply- do
** Near: get :name

我不明白为什么test-parent无法访问%test-child.r设置的Child

如果我从test-parent.r标头中删除Needs字段,而是在DO%test-child.r中插入一行,则没有错误,脚本按预期执行。


I'd like to know the behaviour of R3 when processing the Needs field of a script header and what implications for word binding it has.

Background. I'm currently trying to port some R2 scripts to R3 in order to learn R3. In R2 the Needs field of a script header was essentially just documentation, though I made use of it with a custom function to reference scripts that are required to make my script run.

R3 appears to call the Needs referenced scripts itself, but the binding seems different to DOing the other scripts.

For example when %test-parent.r is:

REBOL [
    title: {test parent}
    needs: [%test-child.r]
]

parent: now
?? parent
?? child

and %test-child is:

REBOL [
    title: {test child}
]

child: now
?? child

R3 Alpha (Saphiron build 22-Feb-2013/11:09:25) returns:

>> do %test-parent.r
Script: "test parent" Version: none Date: none
child: 9-May-2013/22:51:52+10:00
parent: 9-May-2013/22:51:52+10:00
** Script error: child has no value
** Where: get ajoin case ?? catch either either -apply- do
** Near: get :name

I don't understand why test-parent cannot access Child set by %test-child.r

If I remove the Needs field from test-parent.r header and instead insert a line to just DO %test-child.r then there is no error and the script performs as expected.


原文:https://stackoverflow.com/questions/16462904
更新时间:2023-08-25 13:08

最满意答案

ProGet v3.5.x版已经解决了这个问题。


ProGet v3.5.x version has resolved the issue.

相关问答

更多
  • 是的,这对于VSTS的包管理来说是可能的。 请注意,列表和删除之间存在差异,我将进一步阐述。 TL; DR从VSTS包管理中删除现有软件包的故事是,您必须是软件包的“所有者”,或者具有“项目管理员”角色才能删除它。 要取消一个包的列表,您只需要“贡献者”角色。 对于这两个选项,只需在VSTS中查看包裹细节,然后从椭圆下的菜单中选择适当的选项: 现在有些背景信息可能会有用。 在visualstudio.com上有一些官方文档可用: 有两种选项可用于从Feed中删除NuGet包的版本。 Unlist :未列出软 ...
  • 没有 由于这个问题被问到,现在可以使用NuGet轻松的工作流程,而不必将软件包提交给源代码管理 您的包管理器控制台需要安装“NuGetPowerTools” : Install-Package NuGetPowerTools 然后,为了使您的项目能够支持包恢复,您需要运行另一个命令: Enable-PackageRestore 现在你已经准备好提交你的代码库没有包文件夹。 以前的命令更改了您的项目文件,以便如果包丢失,它们将自动下载并添加。 资源 使用NuGet而不提交包来源控件 Since askin ...
  • 我找到了一个工作。 [1]我确认我的用户名:密码组合是正确的。 [2]然后,我将原始提要重命名为feed_old(或者任何你想要的,或者甚至删除它,如果它没有任何重要的东西的话),我已经创建了这个提要用于试验,哪些不允许通过teamcity发布并给出错误根据问题的消息发送消息。 [3]以我想要的名称创建新的Feed。 [4]确认我在API key中使用的用户名具有发布到我刚刚创建的新提要的必要权限。 [5]然后通过teamcity和VOILA测试发布到这个feed! 有效。 尽管如此,我不知道为什么会发生这 ...
  • 根据matthews回复https://github.com/Azure/azure-webjobs-sdk/issues/663