Difference between revisions of "Basic Pascal Tutorial/Chapter 4/Forward Referencing/ja"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{Forward Referencing}} 4F - Forward Referencing (author: Tao Yue, state: unchanged) After all these confusing topics, here's something easy. Remember that procedures/funct...")
 
Line 1: Line 1:
{{Forward Referencing}}
+
{{Forward Referencing/ja}}
  
4F - Forward Referencing (author: Tao Yue, state: unchanged)
+
4F - 前方参照 (著者: Tao Yue, 状態: 原文のまま変更なし)
  
After all these confusing topics, here's something easy.
+
難しいトピックが続いたが、ここでは簡単なことを話そう。
  
Remember that procedures/functions can only see variables and other subprograms that have already been defined? Well, there is an exception.
+
手続きや関数はすでに定義済みの変数やサブプログラムだけを見ることができたことを思いだそう。だが、ひとつ例外がある。
  
If you have two subprograms, each of which calls the other, you have a dilemma that no matter which you put first, the other still can't be called from the first.
+
お互いが他方を呼び出している2つのサブプログラムがあるとすると、どちらを最初に置くべきかというジレンマが生じる。もう一方は最初のものからまだ呼び出せないからである。
  
To resolve this chicken-and-the-egg problem, use ''forward referencing''.
+
この「卵が先か鶏が先か」問題をとくためには ''forward referencing'' を使う。
 
<syntaxhighlight>
 
<syntaxhighlight>
 
procedure Later (parameter list); forward;
 
procedure Later (parameter list); forward;
Line 26: Line 26:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The same goes for functions. Just stick a forward; at the end of the heading.
+
関数も同様である。単にヘッディングの終わりに forward をつければ良い。
  
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"
|[[Recursion|previous]]   
+
|[[Recursion/ja|previous]]   
|[[Contents|contents]]  
+
|[[Contents/ja|contents]]  
|[[Programming_Assignment_4|next]]
+
|[[Programming_Assignment_4/ja|next]]
 
|}
 
|}

Revision as of 10:55, 2 September 2015

Template:Forward Referencing/ja

4F - 前方参照 (著者: Tao Yue, 状態: 原文のまま変更なし)

難しいトピックが続いたが、ここでは簡単なことを話そう。

手続きや関数はすでに定義済みの変数やサブプログラムだけを見ることができたことを思いだそう。だが、ひとつ例外がある。

お互いが他方を呼び出している2つのサブプログラムがあるとすると、どちらを最初に置くべきかというジレンマが生じる。もう一方は最初のものからまだ呼び出せないからである。

この「卵が先か鶏が先か」問題をとくためには forward referencing を使う。

procedure Later (parameter list); forward;

procedure Sooner (parameter list);
begin
  ...
  Later (parameter list);
end;
...
procedure Later;
begin
  ...
  Sooner (parameter list);
end;

関数も同様である。単にヘッディングの終わりに forward をつければ良い。

previous contents next