ReigsterOverrideOrDefault needs a default. What will be the default value?

-----Original Message-----
From: "Keith Dahlby" <notifications@github.com>
Sent: ‎7/‎29/‎2013 8:26 PM
To: "scriptcs/scriptcs" <scriptcs@noreply.github.com>
Cc: "Glenn Block" <glenn.block@gmail.com>
Subject: Re: [scriptcs] Wiring up module loader to load at runtime (#379)

In src/ScriptCs.Hosting/ScriptServicesBuilder.cs:
> +
> +        public ScriptServicesBuilder (IConsole console, ILog logger, IRuntimeServices runtimeServices = null)
> +        {
> +            _initializationServices = new InitializationServices(logger);
> +            _runtimeServices = runtimeServices;
> +            _console = console;
> +            _logger = logger;
> +        }
> +
> +        public ScriptServices Build()
> +        {
> +            var defaultExecutorType = _debug ? typeof (DebugScriptExecutor) : typeof (ScriptExecutor);
> +            var defaultEngineType = _debug ? typeof (RoslynScriptDebuggerEngine) : typeof (RoslynScriptEngine);
> +
> +            _scriptExecutorType = _overrides.ContainsKey(typeof(IScriptExecutor)) ? (Type)_overrides[typeof(IScriptExecutor)] : defaultExecutorType;
> +            _scriptEngineType = _overrides.ContainsKey(typeof(IScriptEngine)) ? (Type) _overrides[typeof(IScriptEngine)] : defaultEngineType;
I'm not suggesting that the conditional logic live in RuntimeServices - the code to inject your default executor/engine into overrides (if necessary) would live here, as a replacement for the _scriptExecutorType and _scriptEngineType fields.
As far as I can tell, this is the only place that you pull a value out of _overrides other than uses of RegisterOverrideOrDefault. Feels odd, but maybe it's just me.
—
Reply to this email directly or view it on GitHub.