<commit_before>//
//  ObservableProperty.swift
//  ReactiveCocoa
//
//  Created by <NAME> on 2014-10-13.
//  Copyright (c) 2014 GitHub. All rights reserved.
//

import Foundation
import LlamaKit

/// A mutable property of type T that allows observation of its changes.
public final class ObservableProperty<T> {
	private let queue = dispatch_queue_create("org.reactivecocoa.ReactiveCocoa.ObservableProperty", DISPATCH_QUEUE_SERIAL)
	private var subscribers = Bag<Subscriber<T>>()

	/// The current value of the property.
	///
	/// Setting this to a new value will notify all subscribers to `values()`.
	public var value: T {
		didSet(value) {
			dispatch_sync(queue) {
				for subscriber in self.subscribers {
					subscriber.put(.Next(Box(value)))
				}
			}
		}
	}

	public init(_ value: T) {
		self.value = value
	}

	deinit {
		dispatch_sync(queue) {
			for subscriber in self.subscribers {
				subscriber.put(.Completed)
			}<commit_msg>Whoops. didSet gets the oldValue.<commit_after>//
//  ObservableProperty.swift
//  ReactiveCocoa
//
//  Created by <NAME> on 2014-10-13.
//  Copyright (c) 2014 GitHub. All rights reserved.
//

import Foundation
import LlamaKit

/// A mutable property of type T that allows observation of its changes.
public final class ObservableProperty<T> {
	private let queue = dispatch_queue_create("org.reactivecocoa.ReactiveCocoa.ObservableProperty", DISPATCH_QUEUE_SERIAL)
	private var subscribers = Bag<Subscriber<T>>()

	/// The current value of the property.
	///
	/// Setting this to a new value will notify all subscribers to `values()`.
	public var value: T {
		didSet {
			dispatch_sync(queue) {
				for subscriber in self.subscribers {
					subscriber.put(.Next(Box(self.value)))
				}
			}
		}
	}

	public init(_ value: T) {
		self.value = value
	}

	deinit {
		dispatch_sync(queue) {
			for subscriber in self.subscribers {
				subscriber.put(.Completed)
			}
{'fraction_non_alphanumeric': 0.11093585699263933, 'fraction_numerical': 0.012618296529968454, 'mean_word_length': 3.364678899082569, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '742', 'n_tokens_mistral': 698, 'n_tokens_neox': 596, 'n_words': 176}