@@ -273,57 +273,67 @@ On the other hand, Ruby acceps a following expression because @if@ is an express
273273result = if cond then process(val) else nil end
274274</pre>
275275
276- Roughly, you can assume any element which can be fed as an argument for a function
277- or a method is a formula.
276+ Roughly speaking, if it can be an argument of a function or a method,
277+ you can consider it as an expression.
278278
279- Of course, there are other languages whose syntactic elements are mostly a formula .
280- Namely, Lisp is the best example. For this characteristic, many people seem to
281- regard Ruby is similar to Lisp.
279+ Of course, there are other languages whose syntactic elements are mostly expressions .
280+ Lisp is the best example. Because of the characteristic around this,
281+ there seems many people who feel like " Ruby is similar to Lisp".
282282
283283h4. Iterators
284284
285285Ruby has iterators. What is an iterator? Before getting into iterators, I should
286286mention the necessity of using an alternative term, because the word "iterator" is
287- disliked recently. However, I don't have a good alternation . So let us keep calling
287+ disliked recently. However, I don't have a good alternative . So let us keep calling
288288it "iterator" for the time being.
289289
290- Well again, what is an iterator? If you are already familiar with a high level
291- function which is similar, you can assume it for now. C-language example is the way
292- you feed function pointer as an argument. C++ example is a way to envelope the
293- operation part of STL's @Iterator@ into a method. If you are familiar with sh and
294- Perl, you can imagine it like a custom defined @for@ statement.
290+ Well again, what is an iterator? If you know higher-order function,
291+ for the time being, you can regard it as something similar to it.
292+ In C-language, the counterpart would be passing a function pointer as an argument.
293+ In C++, it would be a method to which the operation part of STL's @Iterator@ is enclosed.
294+ If you know @sh@ or @Perl@,
295+ it's good to imagine something like a custom @for@ statement which we can define.
295296
296297Yet, the above are merely examples of "similar" concepts. All of them are similar,
297298but they are not identical to Ruby's iterator. I will expand the precise story
298299when it's a good time later.
299300
300301h4. Written in C-language
301302
302- Being written in C-language is not distinctive these days, but it's still a notable
303- characteristic for sure. Unlike being written in Haskell or PL/I, it should possibly
304- be readable for a wide range of people generally. (I want you to confirm it in the
305- later in this book.)
303+ Being written in C-language is not notable these days, but it's still a
304+ characteristic for sure.
305+ At least it is not written in Haskell or PL/I,
306+ thus there's the high possibility that the ordinary people can read it.
307+ (Whether it is truly so, I'd like you confirm it by yourself.)
306308
307309Well, I just said it's in C-language, but the actual language version which ruby is
308310targetting is basically K&R C. Until a little while ago, there were a decent number
309- of - not plenty though - K&R-only-environment. Considering the trend of ANSI C being
310- a popular environment that seems to pass most of programs, there appears to be no
311- problem to port to ANSI C. However, the K&R style code is still maintained, with the
312- author Matsumoto's preference being one aspect.
311+ of - not plenty though - K&R-only-environment.
312+ But recently, there are a few environments which do not accept programs
313+ written in ANSI C, technically there's no problem to move on to ANSI C.
314+ However, also because of the author Matsumoto's personal preference,
315+ it is still written in K&R style.
313316
314317For this reason, the function definition is all in K&R style, and the prototype
315- declarations are not strictly written. Looking at the mailing list, I can see a lot
316- of topics in which @gcc@ with @-Wall@ option outputs a huge dump of errors, and C++
317- compiler warns prototype mismatch that fails to finish compiling.
318+ declarations are not so seriously written.
319+ If you carelessly specify @-Wall@ option of @gcc@,
320+ there would be plenty of warnings shown.
321+ If you try to compile it with a C++ compiler,
322+ it would warn prototype mismatch and could not compile.
323+ ... These kind of stories are often reported to the mailing list.
324+
318325
319326h4. Extension library
320327
321- Ruby library can be written in C. It can be loaded at execution without recompiling Ruby.
328+ We can write a Ruby library in C and load it at runtime without recompiling Ruby.
322329This type of library is called "Ruby extension library" or just "Extension library".
323330
324- In addition to the fact that's written in C, one of the important feature is that Ruby
325- level and C level code differences are very small. Most commands available in Ruby are
326- also available in C. See following example.
331+ Not only the fact that we can write it in C,
332+ but the very small difference in the code expression between Ruby-level and
333+ C-level is also a significant trait.
334+ As for the operations available in Ruby,
335+ we can also use them in C in the almost same way.
336+ See the following example.
327337
328338<pre class="emlist">
329339# Method call
@@ -353,24 +363,24 @@ h4. Thread
353363Ruby is equipped with thread. Assuming a very few people knowing none about thread these
354364days, I will omit an explanation about the thread itself. I will start a story in detail.
355365
356- The thread level of @ruby@ belongs to the user level of origin . The characteristic of
366+ +ruby+'s thread is a user-level thread that is originally written . The characteristic of
357367this implementation is a very high portability in both specification and implementation.
358368Surprisingly a MS-DOS can run the thread. Furthermore, you can expect the same response
359369in any environment. Many people mention that this point is the best feature of @ruby@.
360370
361371However, as a trade off for such an extremeness of portability, @ruby@ abandons the speed.
362372It's, say, probably the slowest of all user-level thread implementations in this world.
363- The trend of @ruby@ implementation may be seen here the most clearly.
373+ The tendency of @ruby@ implementation may be seen here the most clearly.
364374
365375h2. Technique to read source code
366376
367377Well. After an introduction of @ruby@, we are about to start reading source code. But wait.
368378
369379Any programmer has to read a source code somewhere, but I guess there are not many occasions
370- that someone teaches you the concrete ways how to read. Why? Is it because writing a program
371- naturally assumes reading a program?
380+ that someone teaches you the concrete ways how to read. Why?
381+ Does it mean you can naturally read a program if you can write a program?
372382
373- I don 't think so. It's not easy to actually read a code written by other people.
383+ But I can 't think reading the program written by other people is so easy .
374384In the same way as writing programs, there must be techniques and theories in reading programs.
375385And they are necessary. Therefore, before starting to ready @ruby@, I'd like to expand a general
376386summary of an approach you need to take in reading a source code.
@@ -382,8 +392,9 @@ At first, I mention the principle.
382392h4. Decide a goal
383393
384394
385- bq.
395+ <blockquote>
386396An important key to reading the source code is to set a concrete goal.
397+ </blockquote>
387398
388399
389400This is a word by the author of Ruby, Matsumoto. Indeed, his word is very convincing for me.
0 commit comments