Permalink
Browse files

use partial blocks where appropriate

  • Loading branch information...
bakkdoor committed Jan 25, 2012
1 parent 0800ae2 commit 2b0293635fba2942f64574943c7e6288d6100657
Showing with 11 additions and 15 deletions.
  1. +2 −4 lib/future.fy
  2. +6 −6 lib/kvo.fy
  3. +1 −3 lib/object.fy
  4. +2 −2 lib/thread_pool.fy
View
@@ -28,7 +28,7 @@ class FutureSend {
def completed! {
@condvar broadcast
unless: @failed do: {
- @continuations each: |c| { c call: @value }
+ @continuations each: @{ call: @value }
}
@continuations = []
}
@@ -152,9 +152,7 @@ class FutureCollection {
}
def each: block {
- @futures each: |f| {
- f when_done: block
- }
+ @futures each: @{ when_done: block }
}
def await_all {
View
@@ -122,21 +122,21 @@ class KVO {
private: '__kvo_add_observer__:for:to:
def __kvo_slot_change__: slotname new: new_val old: old_val {
- if: (__kvo_slot_observers__[slotname]) then: |set| {
- set each: |b| { b call: [new_val, old_val] }
+ if: (__kvo_slot_observers__[slotname]) then: @{
+ each: @{ call: [new_val, old_val] }
}
}
private: '__kvo_slot_change__:new:old:
def __kvo_insertion__: value for_slot: slotname {
- if: (__kvo_insertion_observers__[slotname]) then: |set| {
- set each: |b| { b call: [value] }
+ if: (__kvo_insertion_observers__[slotname]) then: @{
+ each: @{ call: [value] }
}
}
def __kvo_removal__: value for_slot: slotname {
- if: (__kvo_removal_observers__[slotname]) then: |set| {
- set each: |b| { b call: [value] }
+ if: (__kvo_removal_observers__[slotname]) then: @{
+ each: @{ call: [value] }
}
}
View
@@ -624,9 +624,7 @@ class Object {
@return @Array@ of slot names that @self has.
"""
- instance_variables map: |s| {
- s rest to_sym
- }
+ instance_variables map: @{ rest to_sym }
}
def sleep: seconds {
View
@@ -76,12 +76,12 @@ class ThreadPool {
# Kills all threads
def close {
- @executors each: |e| { e close }
+ @executors each: @{ close }
}
# Sleeps and blocks until the task queue is finished executing
def join {
- { Thread sleep: 0.1 } until: { { @queue empty? } && { @executors all?: |e| { e active not } } }
+ { Thread sleep: 0.1 } until: { { @queue empty? } && { @executors all?: @{ active not } } }
}
class Completable {

0 comments on commit 2b02936

Please sign in to comment.