Skip to content

Commit 64d7d38

Browse files
authored
Fix weird line breaks (#1115)
1 parent 1efabad commit 64d7d38

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

frontend/docs/scripting/language/reference/12-Assorted-tips.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ In other words, the char operators divides its left operand by the number of
4141
bytes that fit in a cell and rounds upwards. Again, in a typical implementation,
4242
this means dividing by four and rounding upwards.
4343

44-
You can design routines that work on strings in both packed and unpacked for-
45-
mats. To find out whether a string is packed or unpacked, look at the first
44+
You can design routines that work on strings in both packed and unpacked formats.
45+
To find out whether a string is packed or unpacked, look at the first
4646
cell of a string. If its value is either negative or higher than the maximum possible
4747
value of an unpacked character, the string is a packed string. Otherwise it
4848
is an unpacked string.
@@ -147,14 +147,13 @@ characters in strings and character constants. The PAWN language
147147
requires that all keywords and symbols (names of functions, variables, tags and other
148148
elements) be encoded in the ascii character set.
149149

150-
For languages whose required character set is relatively small, a common solu-
151-
tion is to use an 8-bit extended ascii character set (the ascii character set is
152-
7-bit, holding 128 characters). The upper 128 codes of the extended set con-
153-
154-
tain glyphs specific for the language. For Western European languages, a well
150+
For languages whose required character set is relatively small, a common solution
151+
is to use an 8-bit extended ascii character set (the ascii character set is
152+
7-bit, holding 128 characters). The upper 128 codes of the extended set contain
153+
glyphs specific for the language. For Western European languages, a well
155154
known character set is “Latin-1”, which is standardized as ISO 8859-1 —the
156-
same set also goes by the name “codepage 1252”, at least for Microsoft Win-
157-
dows.∗ Codepages have been defined for many languages; for example, ISO
155+
same set also goes by the name “codepage 1252”, at least for Microsoft Windows.∗
156+
Codepages have been defined for many languages; for example, ISO
158157
8859-2 (“Latin-2”) has glyphs used in Central and Eastern Europe, and ISO
159158
8859-7 contains the Greek alphabet in the upper half of the extended ascii set.
160159

@@ -183,16 +182,16 @@ the 7-bit ascii set) can still be indicated by a single byte. The
183182

184183
Codepages become problematic when interchanging documents or data with
185184
people in regions that use a different codepage, or when using different
186-
languages in the same document. Codepages that use “shift” characters compli-
187-
cate the matter further, because text processing must now take into account
185+
languages in the same document. Codepages that use “shift” characters complicate
186+
the matter further, because text processing must now take into account
188187
that a character may take either one or two bytes. Scanning through a string
189188
from right to left may even become impossible, as a byte may either indicate a
190189
glyph from the base set (“unshifted”) or it may be a glyph from a shifted set
191190
-in the latter case the preceding byte indicates the shift set, but the meaning
192191
of the preceding character depends on the character before that.
193192

194-
The ISO/IEC 10646 “Universal Character Set” (UCS) standard has the ambi-
195-
tious goal to eventually include all characters used in all the written
193+
The ISO/IEC 10646 “Universal Character Set” (UCS) standard has the ambitious
194+
goal to eventually include all characters used in all the written
196195
languages in the world, using a 31-bit character set. This solves both of the problems
197196
related to codepages and “shifted” character sets. However, the ISO/IEC body
198197
could not produce a standard in time, and therefore a consortium of mainly
@@ -225,8 +224,8 @@ emerged in two different ways: either the internal representation of characters
225224
is multi-byte (typically 16-bit, or 2-byte), or the application stores strings
226225
internally in UTF-8 format, and these strings are converted to the proper glyphs
227226
only when displaying or printing them. Recent versions of Microsoft Windows
228-
use Unicode internally; The Plan-9 operating system pioneered the UTF-8 en-
229-
coding approach, which is now widely used in Unix/Linux. The
227+
use Unicode internally; The Plan-9 operating system pioneered the UTF-8 encoding
228+
approach, which is now widely used in Unix/Linux. The
230229
advantage of UTF-8 encoding as an internal representation is that it is physically an 8-
231230
bit encoding, and therefore compatible with nearly all existing databases, file
232231
formats and libraries. This circumvents the need for double entry-points for
@@ -330,10 +329,10 @@ x = valencia /* ok */
330329

331330
```
332331

333-
The first assignment causes a “tag mismatch” diagnostic as it assigns an “or-
334-
ange” tagged variable to a variable with an “apple” tag. The second assignment
335-
puts the untagged value of x into a tagged variable, which causes again a di-
336-
agnostic. When the untagged variable is on the left hand of the assignment
332+
The first assignment causes a “tag mismatch” diagnostic as it assigns an “orange”
333+
tagged variable to a variable with an “apple” tag. The second assignment
334+
puts the untagged value of x into a tagged variable, which causes again a diagnostic.
335+
When the untagged variable is on the left hand of the assignment
337336
operator, as in the third assignment, there is no warning or error message. As
338337
variable x is untagged, it can accept a value of any weak tag.
339338

@@ -356,14 +355,14 @@ if (apple:valencia < elstar)
356355
```
357356

358357
The test expression of the if statement (between parentheses) compares the
359-
variable valencia to the variable elstar. To avoid a “tag mismatch” diagnos-
360-
tic, it puts a tag override apple: on valencia —after that, the expressions
358+
variable valencia to the variable elstar. To avoid a “tag mismatch” diagnostic,
359+
it puts a tag override apple: on valencia —after that, the expressions
361360
on the left and the right hands of the > operator have the same tag
362361
name: “apple:”. The second line, the assignment of elstar to valencia, overrides
363362
the tag name of elstar or orange: before the assignment. In an assignment,
364363
you cannot override the tag name of the destination; i.e., the left hand of
365-
the = operator. It is an error to write “apple:valencia = elstar”. In the as-
366-
signment, valencia is an “lvalue” and you cannot override the tag name of an
364+
the = operator. It is an error to write “apple:valencia = elstar”. In the assignment,
365+
valencia is an “lvalue” and you cannot override the tag name of an
367366
lvalue.
368367

369368
As shown earlier, when the left hand of an assignment holds an
@@ -437,8 +436,8 @@ in the above snippet (which uses the original definition of printf), I
437436
needed to put an empty tag override, “\_:”, before the variables value and limit in
438437
the first printf call.
439438

440-
There is an alternative to untagging expressions with strong tag names in gen-
441-
eral purpose functions: adjust the definition of the function to accept both
439+
There is an alternative to untagging expressions with strong tag names in general
440+
purpose functions: adjust the definition of the function to accept both
442441
all weak tags and a selective set of strong tag names. The PAWN language supports
443442
multiple tag names for every function arguments. The original definition of printf (from the file console.inc) is:
444443

@@ -463,8 +462,8 @@ native printf(const format[], {Float, _}: ...);
463462
464463
```
465464

466-
Plural tags allow you to write a single function that accepts cells with a pre-
467-
cisely specified subset of tags (strong and/or weak). While a function argument
465+
Plural tags allow you to write a single function that accepts cells with a precisely
466+
specified subset of tags (strong and/or weak). While a function argument
468467
may accept being passed actual arguments with diverse tags, a variable can
469468
only have a single tag —and a formal function argument is a local variable in
470469
the body of the function. In the presence of plural tags, the formal function
@@ -517,12 +516,12 @@ print("Hello \
517516
518517
### • A program that generates its own source code
519518
520-
An odd, slightly academic, criterion to quantify the “expressiveness” of a pro-
521-
gramming language is size of the smallest program that, upon execution, re-
519+
An odd, slightly academic, criterion to quantify the “expressiveness” of a programming
520+
language is size of the smallest program that, upon execution, re-
522521
generates its own source code. The rationale behind this criterion
523522
is that the shorter the self-generating program, the more flexible and expressive the
524-
language must be. Programs of this kind have been created for many program-
525-
ming languages —sometimes surprisingly small, as for languages that have a
523+
language must be. Programs of this kind have been created for many programming
524+
languages —sometimes surprisingly small, as for languages that have a
526525
built-in reflective capabilities.
527526
528527
Self-generating programs are called “quines”, in honour of the

0 commit comments

Comments
 (0)