Add tags

Add tags to the following comment

Factor では with-scope で変数のスコープを限定しないと、その変数のスコープは関数(ワード)をまたいでしまいます。

スタックベースの言語では関数ローカル変数はあまり需要がありませんし、Factor では変数は通常関数をまたいで情報を受け渡しするために使うためでしょう。

ということで with-scope で囲めばそのスコープ内の変数を namespace で取得できます。

1
2
3
4
5
6
7
8
USE: namespaces
: foo
    [ 1 "x" set
      "hello" "y" set
      namespace ] with-scope ;

USE: prettyprint
foo . ! => H{ { "x" 1 } { "y" "hello" } }

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...