--[=[
	Constructs a new Observable

	```lua
	local function observeAllChildren(parent)
		return Observable.new(function(sub)
			local maid = Maid.new()

			for _, item in pairs(parent:GetChildren()) do
				sub:Fire(item)
			end
			maid:GiveTask(parent.ChildAdded:Connect(function(child)
				sub:Fire(child)
			end))

			return maid
		end)
	end

	-- Prints out all current children, and whenever a new
	-- child is added to workspace
	local maid = Maid.new()
	maid:GiveTask(observeAllChildren(workspace):Subscribe(print))
	```

	@param onSubscribe (subscription: Subscription<T>) -> MaidTask
	@return Observable<T>
]=]

function Observable.new(onSubscribe)
	assert(type(onSubscribe) == "function", "Bad onSubscribe")

	return setmetatable({
		_source = ENABLE_STACK_TRACING and debug.traceback() or "";
		_onSubscribe = onSubscribe;
	}, Observable)
end
