website/index.txt in patternmatching-0.1.4 vs website/index.txt in patternmatching-0.2.0
- old
+ new
@@ -22,13 +22,11 @@
Note: Default equivalence used in structured pattern matching is
based on "<code>pattern === data</code>",
so "<code>foo(Numeric)</code>" matches "<code>foo(100)</code>".
-Notice: Current implementation is not thread safe now.
-Need the receiver object(NOT an argument) calling pattern matching
-synchronized when multi-threaded access.
+From ver. 0.2.0, thread unsafeness restriction is removed.
h2. Demonstration of usage
Symbols(e.g. <code>:a</code>, <code>:right_value</code>)
in patterns is passed as variable
@@ -147,10 +145,51 @@
puts "no name"
end
end # => "He is Jiro"
</pre>
+<h3>Field Access Example</h3>
+It is ver 0.2.0 API
+<pre>
+require "patternmatching"
+
+include PatternMatching
+
+class Foo
+ def initialize
+ @name = "Foo"
+ end
+ attr :name
+ def foo
+ end
+
+ def bar
+ make "bar" do
+ seems as {:val} do
+ foo
+ # To access fields like this.name or this.name = ...
+ the.name = val
+ # To access self as this
+ this
+ end
+ end
+ end
+
+ func(:buzz).seems as {:val} do
+ the.name = val
+ this
+ end
+end
+
+o = Foo.new
+p o.bar == o #=> true
+p o.name #=> "bar"
+p o.buzz("buzz") == o #=> true
+p o.name #=> "buzz"
+</pre>
+
+
h2. Forum
Visit RubyForge project forum.
h2. How to submit patches
@@ -161,10 +200,10 @@
h2. License
This code is free to use under the terms of the MIT license.
-h2. Link
+h2. Links
* "Web Site":http://patternmatching.rubyforge.org/
* "Project Page":http://rubyforge.org/projects/patternmatching/
* "API Doc":http://patternmatching.rubyforge.org/rdoc/