Skip to content

Making the mono module no-op unless the mono runtime is present #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2014

Conversation

glennblock
Copy link
Contributor

Fix for #1

Requires: scriptcs/scriptcs#635 to be merged first.

@@ -3,13 +3,16 @@

namespace ScriptCs.Engine.Mono
{
[Module("mono", Extensions = "csx")]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly for my education, but why do we no longer need to set the extension?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the REPL to just work so it needs to load the module all the time as there is no extension it can look for. We don't want people to have to specify the mono module, it should just work.

One thing you did make me realize (thanks) however is that the module should only register an engine IF one was not already registered.

I've added an conditional check for this module and the new Roslyn Module that will only register IF no other engine has already been provided. This way the F# module etc will still work and not be overridden. Order also doesn't matter, because let's say the F# module loads first, then it will register itself and not be overridden. If the Roslyn/Mono module is registered first then it will be overridden.

Make sense?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense.

@adamralph
Copy link

Oh, I was going to merge this but I don't have the right permissions in the scriptcs-contrib org.

@glennblock
Copy link
Contributor Author

Contrib projects are up to the owner (@filipw in this case) of each project to add who they want.

@filipw
Copy link
Contributor

filipw commented Apr 22, 2014

I agree with the idea (after all, we discussed it) - but what if I want to run the mono.csharp engine on windows? (i.e. for dynamic etc). it wouldn't be possible now.

It feels like it would make sense to push the args to the modules so that there can be some switch or something like that.

@glennblock
Copy link
Contributor Author

It should work. If you run with the mono runtime it will use the mono
engine.

On Mon, Apr 21, 2014 at 11:26 PM, Filip W [email protected] wrote:

I agree with the idea (after all, we discussed it) - but what if I want to
run the mono.csharp engine on windows? (i.e. for dynamic etc). it
wouldn't be possible now.

It feels like it would make sense to push the args to the modules so that
there can be some switch or something like that.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-41007617
.

@glennblock
Copy link
Contributor Author

So on Windows, I run with the mono runtime to get the mono engine, if I run
with the standard .net engine (i.e. just run scriptcs.exe directly) it uses
the .NET engine. There's no value in the switch as it's the runtime that
determines which engine will be usable.

On Mon, Apr 21, 2014 at 11:27 PM, Glenn Block [email protected] wrote:

It should work. If you run with the mono runtime it will use the mono
engine.

On Mon, Apr 21, 2014 at 11:26 PM, Filip W [email protected]:

I agree with the idea (after all, we discussed it) - but what if I want
to run the mono.csharp engine on windows? (i.e. for dynamic etc). it
wouldn't be possible now.

It feels like it would make sense to push the args to the modules so that
there can be some switch or something like that.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-41007617
.

@glennblock
Copy link
Contributor Author

Sorry I mean if I run with the standard .NET runtime by just running
scriptcs.exe it uses the .NET engine.

On Mon, Apr 21, 2014 at 11:28 PM, Glenn Block [email protected] wrote:

So on Windows, I run with the mono runtime to get the mono engine, if I
run with the standard .net engine (i.e. just run scriptcs.exe directly) it
uses the .NET engine. There's no value in the switch as it's the runtime
that determines which engine will be usable.

On Mon, Apr 21, 2014 at 11:27 PM, Glenn Block [email protected]:

It should work. If you run with the mono runtime it will use the mono
engine.

On Mon, Apr 21, 2014 at 11:26 PM, Filip W [email protected]:

I agree with the idea (after all, we discussed it) - but what if I want
to run the mono.csharp engine on windows? (i.e. for dynamic etc). it
wouldn't be possible now.

It feels like it would make sense to push the args to the modules so
that there can be some switch or something like that.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-41007617
.

@glennblock
Copy link
Contributor Author

See this screenshot from here (http://mono-project.com/Using_Mono_on_Windows)
get my point:

[image: Inline image 1]

If you run scriptcs.exe using mono i.e. mono scriptcs.exe then the mono
types will be avail and the mono engine will be registered.

On Mon, Apr 21, 2014 at 11:29 PM, Glenn Block [email protected] wrote:

Sorry I mean if I run with the standard .NET runtime by just running
scriptcs.exe it uses the .NET engine.

On Mon, Apr 21, 2014 at 11:28 PM, Glenn Block [email protected]:

So on Windows, I run with the mono runtime to get the mono engine, if I
run with the standard .net engine (i.e. just run scriptcs.exe directly) it
uses the .NET engine. There's no value in the switch as it's the runtime
that determines which engine will be usable.

On Mon, Apr 21, 2014 at 11:27 PM, Glenn Block [email protected]:

It should work. If you run with the mono runtime it will use the mono
engine.

On Mon, Apr 21, 2014 at 11:26 PM, Filip W [email protected]:

I agree with the idea (after all, we discussed it) - but what if I want
to run the mono.csharp engine on windows? (i.e. for dynamic etc). it
wouldn't be possible now.

It feels like it would make sense to push the args to the modules so
that there can be some switch or something like that.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-41007617
.

filipw added a commit that referenced this pull request Apr 22, 2014
Making the mono module no-op unless the mono runtime is present
@filipw filipw merged commit 8d7781e into scriptcs-contrib:master Apr 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants