function Blend.Shared(b)return b:Pipe({Rx.cache()})end function Blend.Dynamic(...)return(Blend.Computed(...)):Pipe({Rx.switchMap(function(b,...)if Promise.isPromise(b)then return Rx.fromPromise(b)elseif Observable.isObservable(b)then return b else return Rx.of(b,...)end end)})end

function Blend.Shared(observable)
	return observable:Pipe({
		Rx.cache();
	})
end

function Blend.Dynamic(...)
	return Blend.Computed(...)
		:Pipe({
			-- This switch map is relatively expensive, so we don't do this for defaul computed
			-- and instead force the user to switch to another promise
			Rx.switchMap(function(promise, ...)
				if Promise.isPromise(promise) then
					return Rx.fromPromise(promise)
				elseif Observable.isObservable(promise) then
					return promise
				else
					return Rx.of(promise, ...)
				end
			end)
		})
end
