tagged release 0.7.1
[parrot.git] / docs / book / ch02_getting_started.pod
blobb71c08a900a4b15b541c1c954298251402c35c53
1 =pod
3 =head1 Project Development
5 Z<CHP-2>
7 The Parrot project is specially organized to be light-weight and
8 efficient. The project is governed like a meritocracy--people who
9 make valuable contributions are offered more responsibility. Communication
10 is relaxed and informal, often intermittent through email and on IRC. As
11 Dan is so fond of saying, "This is far too important to take seriously."
12 The Parrot developers act a bit like a special forces unit--the objective
13 is pursued not because of tight control from the top, but because the whole
14 team knows the task at hand and does it.
16 =head2 Development Cycles
18 Z<CHP-2-SECT-2.1>
20 X<development cycles;Parrot>
21 The Parrot development cycle centers on regular "point releases." A point
22 release is a version change, such as 0.4.x to 0.5.x. The architect and
23 project manager decide when point releases happen and what features are
24 included.  Usually one or two solid new features trigger a point release.
26 Development proceeds at a steady pace with bugs reported, patches
27 submitted, and patches applied. The pace isn't so much a result of
28 careful planning as it is the law of averages--on any given day,
29 someone, somewhere, is working on Parrot. In periods of high activity
30 there are often many more people working on Parrot then just one. A
31 release represents a spike in that activity, but since Parrot tends
32 to follow the "release early, release often" strategy, these spikes are
33 relatively small.
35 Typically, the release manager for the month declares a feature freeze
36 several days before each release. During these freezes all development
37 efforts are redirected to testing and bug fixing. This periodic cleanup
38 is one of the most valuable aspects of a release.
40 =head2 Getting Involved
42 Z<CHP-2-SECT-2.2>
44 X<p2 (Parrot mailing list)>
45 X<Parrot;getting involved>
46 The first step to getting involved in the Parrot project, whether you
47 want to hack code, write documentation, or help in other ways, is to
48 join the Parrot-porters (p2) mailing list. The topics on p2 tend to
49 revolve around practical matters: bug reports, patches, notifications
50 of changes committed to the subversion repository, and questions on
51 coding style. Occasionally there are discussions about how to implement
52 particular features, although such discussions are often better-suited
53 for other communications media, such as IRC.
55 The Parrot developers, along with other volunteers and well-wishers
56 tend to congregate on IRC as well. They maintain a chatroom C<#parrot>
57 on the U<irc://irc.perl.org> server. To get real-time answers to
58 questions, or just to see how things are progressing, the chatroom
59 is invaluable.
61 =head3 Use the source
63 Z<CHP-2-SECT-2.2.1>
65 X<Parrot;source code>
66 The second step to participating in Parrot development is to get a
67 copy of the source code. If you just want to try it out--experiment
68 with a few features and see how it feels--you're probably best off
69 downloading a tarball. For the most stable copy, grab the latest point
70 release from CPAN. The sure way to get the most recent release is at
71 U<http://search.cpan.org/dist/parrot/> (or search for "parrot" in
72 "Distributions"). If you want something a little more cutting edge than
73 the packaged release, a new snapshot of the subversion repository is
74 created every eight hours. The most recent snapshot is always available
75 at U<http://cvs.perl.org/snapshots/parrot/parrot-latest.tar.gz>.
77 If you plan to get involved in development, you'll want to check out
78 the source from the subversion repository. Anyone can get anonymous
79 access, committers use their U<http://auth.perl.org> username.
81   svn co https://svn.perl.org/parrot/trunk parrot
83 There's also a web interface for viewing files in the repository at
84 U<http://svn.perl.org/viewcvs/parrot/>.
86 Now that you've got the source, take a moment to look around. The code
87 changes constantly, so a detailed description of every file is
88 impossible. But a few road signs are helpful starting out.
90 The most important top-level directory is F<docs/>.  The content isn't
91 always up to date, but it is a good place to start. F<parrot.pod>
92 provides a quick overview of what's in each documentation file. If you're
93 a capable writer and know a thing or two about how Parrot works,
94 the documentation is a great place to start contributing.
96 The F<languages/> directory contains the code that implements various
97 language compilers: Perl 6, Python ("Pynie"), Ruby ("Cardinal"), PHP
98 ("Pipp"), Lisp, Lua, Tcl ("partcl"), WMLScript, Forth, Scheme,
99 Befunge, BASIC, and many others. These language compilers are in
100 various stages of partial completion. The file F<LANGUAGES.STATUS>
101 provides meta information on the included languages and on the many
102 language projects that are being developed and maintained outside the
103 Parrot repository.  If you have a language you're particularly
104 interested to see implemented on Parrot, you can see how far along the
105 effort is, or you can start the work to implement it yourself.
107 The F<lib/> directory contains Perl 5 classes currently used in
108 developing Parrot. The F<src/pmc/> directory contains the C source
109 code for Parrot classes (PMCs, which you'll read more about in
110 A<CHP-9>Chapter 9). The F<examples/> directory contains some example
111 Parrot assembler code, as well as benchmarks.
113 =head1 Building Parrot
115 Z<CHP-9-SECT-1>
117 X<Parrot;source code>
118 The first step before you start playing with Parrot's PASM and PIR
119 code is to get a copy of the source code and compile it. PASM is
120 the Parrot assembly language and is introduced in A<CHP-5>Chapter 5.
121 PIR, an intermediate-level language that is used most often in compiler
122 development, is discussed in A<CHP-3>Chapter 3.
124 The basic steps involved in building Parrot from the source code from
125 the command line are: N<Not all operating systems have F<make>. Check
126 the documentation for instructions for systems that aren't Unix-based.>
128   $ perl Configure.pl
129   $ make
130   $ make test
132 X<PASM (Parrot assembly language);compiling>
133 Once you've compiled Parrot, create a small test file in the main
134 F<parrot> directory.  We'll call it F<fjord.pasm>.
136   print "He's pining for the fjords.\n"
137   end
139 X<.pasm files>
140 I<.pasm> is the standard extension for Parrot assembly language source
141 files. Now you can run this file with:
143   $ ./parrot fjord.pasm
145 And watch the result of the program execution. Instead of executing
146 the program immediately, you could also compile it to bytecode:
148   $ ./parrot --output fjord.pbc fjord.pasm
150 You specify the name of the output bytecode file with the C<--output>
151 (or C<-o>) switch.  I<.pbc> is the standard extension for Parrot
152 bytecode. To execute the compiled bytecode, run it through the
153 F<parrot> interpreter:
155   $ ./parrot fjord.pbc
157 This is, of course, a simple and contrived example. In the next few
158 chapters we will discuss more aspects of Parrot programming using
159 both PASM and PIR, and we will discuss some of the more advanced
160 features of Parrot that make it an interesting and attractive
161 programming platform.
163 =head3 Patch submission
165 Z<CHP-2-SECT-2.2.2>
167 X<Parrot;patch submission>
168 Parrot development proceeds through a continuous stream of patches.
169 Patches are the currency of exchange in the project--the unit of
170 work. Patches can fix bugs, add features, modify capabilities,
171 remove cruft, and improve the suite of tests and the project
172 documentation. If something needs to change, it will typically require
173 the submission of a new patch.
175 While anyone is free to submit a patch, only a small number of people have
176 the ability to apply patches to the central Parrot repository.
177 These people are called I<committers>. By allowing all people to get
178 involved through patch submission and testing, the project can harness
179 the efforts of a large group but still keep the same high quality
180 as a small group of experienced developers.
182 Every submitted patch is automatically forwarded to the p2 list where
183 it's subject to peer review. Small patches typically spark little debate,
184 and can be well-tested on many platforms before being committed to the
185 repository. Patches tend to be small modular changes, which makes for
186 easy testing and evaluation. Occasionally a large feature such as an entire
187 language implementation is submitted in a single patch, but these are the
188 exceptions.
190 Submitting a patch is fairly straightforward. You create a file that
191 lists all your changes, a diff or a patch, and email it to the ticket
192 tracking system at U<parrotbug@parrotcode.org>. It's important to make
193 sure your patch and your email have descriptive titles so that the
194 committers and testers have a better idea about what it does. The body of
195 your email should also include a good description about what you changed
196 and why.
198 It's important that you create your patches from a checked-out subversion
199 repository, not from a tarball or or snapshot. This way, you can ensure
200 that your diff is made against the latest version of the files. If you patch
201 an old version, the problem may have already been resolved! Make sure
202 the paths listed in the patch match those in the repository. There are two
203 methods of creating patches that will do this for you. You can make changes
204 directly in your checked-out copy of the subversion repository and
205 then create diffs using the command C<svn diff>. Alternatively, you can
206 make a copy of the repository and then create diffs between the two
207 copies with the C<diff -u> command:
209   diff -u parrot/README parrot_changed/README
211 Either method is fine, and both are equally common on p2. Your
212 working style and the types of changes you make--small and modular
213 versus large and sweeping--will influence which method you choose.
215 Next, when you're making changes, take some extra time to consider how
216 your patch affects the rest of the system. If your patch adds a new
217 file, patch the main F<MANIFEST> file to include it. If you add a new
218 feature, make sure to write tests for it. If you fix a bug, add a test
219 to prove that it's fixed. See A<CHP-9-SECT-13>"Writing Tests" in Chapter
220 9 for more on writing tests for Parrot. Tests are very important for
221 Parrot development, and writing good tests is a valuable skill for
222 developers to have. Before you submit a patch always recompile the
223 system yourself with the patch included and run all tests to prove that
224 it works. You can build and test Parrot completely by running the
225 following commands:
227   make clean
228   perl Configure.pl
229   make
230   make test
232 Consider the people who will review and apply your patch, and try
233 to make their jobs easier. Patch filenames should be as descriptive as
234 possible: F<fix_readme_aardvark_typo.patch> is far better than
235 F<README.patch>. An attached file is better than a diff pasted into an
236 email, because it can be applied without manual editing. The
237 conventional extension for patch files is F<.patch>.
239 In the email message, always start the subject with "[PATCH]", and
240 make the subject as clear as possible: "[PATCH] misspelled aardvark in
241 main README file" is better than "[PATCH] typo". The body of the
242 message should clearly explain what the patch is supposed to do and
243 why you're submitting it. Make a note if you're adding or deleting
244 files so they won't be missed.
246 Here is a good example of a patch submission using the subversion diff
247 method (an actual patch from p2). It's short, sticks to the point, and
248 clearly expresses the problem and the solution. The patch filename and
249 the subject of the message are both descriptive:
251 =for author
253 Possible alternates: ticket #23501, #24053 (not from top level)
255 =end for
257   Subject: [PATCH] Pointers in List_chunk not initialized
258   From: Bruce Gray
259   
260   On Win32, these tests are segfaulting due to invalid
261   pointers in List_chunk structs:
262   t/op/string.t             97-98
263   t/pmc/intlist.t           3-4
264   t/pmc/pmc.t               80
265   
266   The problem is caused by list.c/allocate_chunk not
267   initializing the pointers. This patch corrects the problem.
268   
269   --
270   Hope this helps,
271   Bruce Gray
273 With the attached file F<list_chunk_initialize.patch>:
276   Index: list.c
277   =========================================
278   RCS file: /cvs/public/parrot/list.c,v
279   retrieving revision 1.23
280   diff -u -r1.23 list.c
281   --- list.c        27 Dec 2002 09:33:11 -0000        1.23
282   +++ list.c        28 Dec 2002 03:37:35 -0000
283   @@ -187,6 +187,10 @@
284        Parrot_block_GC_sweep(interpreter);
285        chunk = (List_chunk *)new_bufferlike_header(interpreter, sizeof(*chunk));
286        chunk->items = items;
287   +    chunk->n_chunks = 0;
288   +    chunk->n_items  = 0;
289   +    chunk->next     = NULL;
290   +    chunk->prev     = NULL;
291        Parrot_allocate_zeroed(interpreter, (Buffer *)chunk, size);
292        Parrot_unblock_GC_mark(interpreter);
293        Parrot_unblock_GC_sweep(interpreter);
295 =head3 Bug tracking
297 Z<CHP-2-SECT-2.2.3>
299 X<Parrot;bug tracking>
300 Bug reports go to the same address as patch submissions
301 (U<parrotbug@parrotcode.org>). Similar conventions apply: make the
302 subject and the message as clear and descriptive as possible. The
303 subject line should start with "[BUG]"  to make it immediately obvious
304 what the message is about.
306 X<Parrot;bug tracking>
307 If you want to track a bug or patch you've submitted, the current
308 queue of bugs and patches is publicly viewable at
309 U<http://rt.perl.org>. Bug tracking for Parrot is handled by the
310 Request Tracker (RT) ticket tracking system from Best Practical
311 Solutions.
313 =cut