Skip to content

Commit

Permalink
translate value-part
Browse files Browse the repository at this point in the history
Signed-off-by: iKaroS <[email protected]>
  • Loading branch information
AngeliKaroS committed Feb 13, 2023
1 parent 5c05d62 commit 0d29967
Showing 1 changed file with 69 additions and 90 deletions.
159 changes: 69 additions & 90 deletions pages/fundamentals/value-part.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
<h1>Value Parts</h1>
<h1>변수</h1>

<p>
The articles following the current one will introduce more kinds of Go types.
To easily and deeply understand those articles,
it is best to read the following contents in the current article firstly
before reading those articles.
이 문서와 다음 문서에서는 더 많은 종류의 Go type들을 소개합니다.
이 다음 문서들을 쉽고 깊게 이해하기 위한 최선의 방법은 다음 문서들을 읽기 전에
이 문서를 먼저 읽는 것입니다.
</p>

<h3>Two Categories of Go Types</h3>
<h3>Go Type들의 두가지 분류</h3>

<div>
<p>
Go can be viewed as a C-family language, which can be confirmed from
the two previous articles <a href="pointer.html">pointers in Go</a>
and <a href="struct.html">structs in Go</a>.
The memory structures of struct types and pointer types in Go and C are much alike.
Go는 <a href="pointer.html">pointers in Go</a><a href="struct.html">structs in Go</a>
이 이전 두 문서들에서 본 것과 같이 C와 비슷한 언어로 여겨진다.
구조체 타입과 포인터 타입들과 같은 메모리 구조는 Go와 C에서 매우 비슷하다.
</p>

<p>
On the other hand, Go can be also viewed as a C language framework.
This is mainly reflected from the fact that Go supports several kinds of types
whose value memory structures are not totally transparent, whereas
the main characteristic of C types is the memory structures of C values are transparent.
Each C value in memory occupies <a href="memory-block.html">one memory block</a> (one continuous memory segment).
However, a value of some kinds of Go types may often be hosted on more than one memory block.
한편으로는, Go는 C언어의 프레임워크로 여겨지기도 합니다.
이 말은 C의 주요 특징으로 메모리 구조들이 투명하다는 점인 반면
Go는 변수-메모리(value-memory) 구조가 완전히 투명하지 않은 여러 종류의 type을 지원한다는 점이 반영 된 것입니다.
각 C언어의 변수들은 하나의 <a href="memory-block.html">메모리 블록</a>(하나의 연속적인 메모리 세그먼트)을 가지고 있습니다.
그러나 Go가 제공하는 type들은 하나나 그 이상의 메모리 블록을 가질 수도 있습니다.
</p>

<p>
Later, we call the parts (being distributed on different memory blocks) of a value as value parts.
A value hosting on more than one memory blocks is composed of one direct value part and several underlying indirect parts
which are <a href="pointer.html#references">referenced</a> by that direct value part.
앞으로, 변수로 이루어진 부분(다른 메모리 블록들에 분산되어 있는)들을 '변수 부분'(value-part)이라고 부르도록 하겠습니다.
변수 부분은 직접 변수 부분(direct value-part)과
직접 변수 부분이 <a href="pointer.html#references">참조</a> 되어있는 간접 변수 부분으로 이루어져 있습니다.
</p>

The above paragraphs describe two categories of Go types:
다음 표는 Go의 두 가지 타입들을 설명합니다:

<table border="1" class="table table-bordered text-center" style="width: auto !important;">
<thead>
<tr class="active">
<th class="text-center" valign="bottom" align="center" style="with: 50%">Types whose values each is only hosted on one single memory block</th>
<th class="text-center" valign="bottom" align="center" style="with: 50%">Types whose values each may be hosted on multiple memory blocks</th>
<th class="text-center" valign="bottom" align="center" style="with: 50%">하나의 메모리 블록만 제공하는 타입들</th>
<th class="text-center" valign="bottom" align="center" style="with: 50%">하나 이상의 메모리 블록들을 제공하는 타입들</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -76,121 +72,104 @@ <h3>Two Categories of Go Types</h3>
</table>

<p>
The following Go 101 articles will make detailed explanations for many kinds of types listed in the above table.
The current article is just to make a preparation to understand those explanations more easily.
다음 Go 101 글은 위 표에 나온 타입들을 자세히 설명합니다.
이 글은 그 설명들을 좀 더 쉽게 이해할 수 있도록 준비 하는 글입니다.
</p>

Note,
<ul>
<li>
whether or not interface and string values may contain underlying parts
is compiler dependent. For the standard Go compiler implementation,
interface and string values may contain underlying parts.
인터페이스와 문자열 변수에 기본 부분(underlying parts)이 포함 될 수 있는지 아닌지의 여부는 컴파일러에 따라 다릅니다.
표준 Go 컴파일러인 경우 인터페이스와 문자열 변수는 기본 부분을 포함 할 수 있습니다.
</li>
<li>
whether or not functions values may contain underlying parts
is hardly, even impossible, to prove.
In Go 101, we will view functions values may contain underlying parts.
함수 변수(functions value)가 기본 부분을 포한 하는지에 대한 여부는 증명하기가 거의 불가능하다.
Go 101 에서는, 함수 변수들은 기본 부분을 포함 하는 것으로 간주하도록 합니다.
</li>
</ul>

<p>
The kinds of types in the second category bring much convenience to Go programming
by encapsulating many implementation details.
Different Go compilers may adopt different internal implementations
for these types, but the external behaviors of values of these types
must satisfy the requirements specified in Go specification.
두 번째 타입 유형 분류는 많은 구현 세부 정보를 캡슐화하여 Go 프로그래밍에 많은 편의를 제공합니다.
서로 다른 Go 컴파일러들은 이 타입들에 대한 세부 구현이 다릅니다.
그러나 그 타입들이 동작하는 방식은 반드시 Go 사양의 요구사항을 만족합니다.
</p>

<p>
The types in the second category are not very fundamental types for a language,
we can implement them from scratch by using the types from the first category.
However, by encapsulating some common or unique functionalities and
supporting these types as the first-class citizens in Go,
the experiences of Go programming become enjoyable and productive.
두번째 분류에 속하는 타입들은 첫번째 분류의 타입들을 모아서 구현할 수 있기 때문에
언어의 구성에서 반드시 필요하지는 않습니다.
그러나, 일반적이거나 독특한 기능을 캡슐화 한 이 타입들을 1급 객체로 지원하므로써
Go 프로그래밍이 조금 더 즐겁고 생산성있는 경험을 제공합니다.
</p>

<p>
On the other hand, these encapsulations adopted in implementing the types
in the second category hide many internal definitions of these types.
This prevents Go programmers from viewing the whole pictures of these types,
and sometimes makes some obstacles to understand Go better.
반면에, 두번째 분류에 캡슐화 되어 구현된 이 타입들은 그 타입들의 많은 내부 구현을 숨깁니다.
이로 인해 Go 프로그래머가 그 타입들에 대한 전체적인 구조를 볼 수 없으며,
때로는 Go를 더 잘 이해하는데에 방해물이 될 수 있습니다.
</p>

<p>
To help gophers better understand the types in the second category
and their values, the following contents of this article will introduce
the internal structure definitions of these kinds of types.
The detailed implementations of these types will not be explained here.
The explanations in this article are based on, but not exactly the same as,
the implementations used by the standard Go compiler.
아래의 글은 Go를 사용하는 사람들에게 두번째 분류에 속한 타입들을 더 이해하기 쉽도록
내부 구조와 정의에 대한 내용을 소개합니다.
이러한 타입들의 상세한 구현은 여기서 설명하지는 않습니다.
이 글은 표준 Go 컴파일러에서 주로 구현된 내용들을 기반으로 하지만 정확히 똑같지는 않습니다.
</p>
</div>

<h3>Two Kinds of Pointer Types in Go</h3>
<h3>Go의 두가지 포인터 타입들</h3>

<div>
<p>
Before showing the internal structure definitions of the kinds of types
in the second category, let's clarify more on pointers and references.
두번째 분류에 속하는 타입들의 내부 구조에 대한 정의를 보기에 앞서,
포인터와 참조에 대해 명확한 정의를 내리고 시작합니다.
</p>

<p>
We have learned <a href="pointer.html">Go pointers</a> in the article before the last.
The pointer types in that article are type-safe pointer types.
In fact, Go also supports <a href="unsafe.html">type-unsafe pointer types</a>.
The <code>unsafe.Pointer</code> type provided in the <code>unsafe</code>
standard package is like <code>void*</code> in C language.
우리는 이전 글에서 <a href="pointer.html">Go 포인터</a>에 대해 배웠습니다.
해당 글에서의 포인터 타입들은 type-safe(선언된 유형과 같은지 체크를 하는) 포인터 타입입니다.
사실, Go는 <a href="unsafe.html">type-unsafe pointer types</a> 포인터 타입도 지원합니다.
<code>unsafe.Pointer</code> 타입은 <code>unsafe</code> 패키지에서 제공되며
C 언어의 <code>void*</code> 와 비슷합니다.
</p>

<p>
In most other articles in Go 101, if not specially specified,
when a pointer type is mentioned, it means a type-safe pointer type.
However, in the following parts of the current article,
when a pointer is mentioned, it might be either a type-safe pointer or a type-unsafe pointer.
Go 101의 대부분의 글에서 포인터 타입을 언급 할때 특별히 명시 하지 않는 한 type-safe 포인터 타입입니다.
그러나 이 글에서 하기의 부분은 type-safe 포인터거나 type-unsafe 포인터 일 수 있습니다.
</p>

A pointer value stores a memory address of another value,
unless the pointer value is a nil pointer.
We can say the pointer value <a href="pointer.html#references">references</a> the other value,
or the other value is referenced by the pointer value.
Values can also be referenced indirectly.
포인터는 nil 포인터가 아닌 이상 다른 변수의 주소를 가지고 있습니다.
포인터 변수는 다른 변수를 <a href="pointer.html#references">참조</a> 하거나 어떤 변수는 포인터 변수에 의해 참조된다고 할 수 있습니다
이들 변수들 또한 간접적으로 참조됩니다.
<ul>
<li>
If a struct value <code>a</code> has a pointer field <code>b</code>
which references a value <code>c</code>, then we can say the struct
value <code>a</code> also references value <code>c</code>.
만약 구조체 변수 <code>a</code>가 변수<code>c</code>를 참조하는 포인터<code>b</code>를 변수로 가지고 있다면,
구조체 변수 <code>a</code>또한 <code>c</code>의 변수을 참조한다고 말할 수 있습니다.
</li>
<li>
If a value <code>x</code> references (either directly or indirectly)
a value <code>y</code>, and the value <code>y</code> references
(either directly or indirectly) a value <code>z</code>,
then we can also say the value <code>x</code> (indirectly)
references value <code>z</code>.
만약 변수 <code>x</code>가 변수 <code>y</code>를 참조(직접적이든 간접적이든 상관없이)하고,
변수 <code>y</code>가 변수 <code>z</code>를 참조(직접적이든 간접적이든 상관없이)한다면,
변수 <code>x</code>가 변수 <code>z</code>를 참조(간접적으로)한다고 말할 수 있습니다.
</li>
</ul>

<p>
Below, we call a struct type with fields of pointer types as a <b>pointer wrapper type</b>,
and call a type whose values may contains (either directly or indirectly) pointers a <b>pointer holder type</b>.
Pointer types and pointer wrapper types are all pointer holder types.
Array types with pointer holder element types are also pointer holder types.
(Array types will be explained in the next article.)
따라서, 구조체 타입이 포인터 타입을 변수로 가지는 것을 <b>포인터 포함 타입(pointer wrapper type)</b>라고 부르며,
간접적이든 직접적이든 포인터를 포함할 수 있는 타입들을<b>포인터 소유 타입(pointer holder type)</b>이라고 부릅니다.
포인터 타입들과 포인터 포함 타입들은 모두 포인터 소유 타입입니다.
포인터 소유 타입으로 이루어진 배열 타입 또한 포인터 소유 타입입니다.
(배열 타입에 대한 설명은 다음 글에서 다룹니다.)
</p>
</div>

<h3>(가능함) 두번째 분류에 속하는 타입들의 내부 구현</h3>
<h3>(Possible) Internal Definitions of the Types in the Second Category</h3>

<p>
To better understand the runtime behaviors of values of the second category,
it is not a bad idea that we could think these types are internally defined
as types in the first category, which are shown below.
If you haven't used all kinds of Go types much,
currently you don't need to try to comprehend these definitions clearly.
Instead, it is okay to just get a rough impression on these definitions
and reread this article when you get more experience in Go programming later.
Knowing the definitions roughly is good enough to help Go programmers
understand the types explained in the following articles.
두번째 분류에 속하는 변수들의 런타임 동작을 보다 더 잘 이해하기 위해서,
그 변수들이 아래와 같이 내부적으로는 첫번째 분류에 속하는 변수으로 정의 되었다고 생각하는 것은 나쁘지 않은 생각입니다.
만약 많은 Go 타입을 사용 해보지 않았다면 당장은 이 구현들을 명확하게 이해하려고 노력할 필요는 없습니다.
이 구현에 대한 개략적인 인상만 받고 가도 괜찮습니다만
대신, 나중에 Go 프로그래밍에 대해 좀 더 경험이 쌓이면 이 글을 다시 읽어주세요.
개략적인 정의를 알고 있는 것만으로도 Go 프로그래머가 다음 글들에서 나오는 타입들에 대한 설명을 이해 하는데에 충분한 도움이 됩니다.
</p>

<h4>Internal definitions of map, channel and function types</h4>
Expand Down

0 comments on commit 0d29967

Please sign in to comment.