No "suitable public constructor"

Oct 7, 2012 at 4:56 AM

I'm trying to use IronScheme to implement scheme as a scripting language in a personal project of mine, but I'm running into problems with the basic setup.  I've tried both of the following:

 

using IronScheme.Hosting;
using IronScheme.Runtime;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;

namespace IronSchemeTest
{

    public class SchemeHandler
    {
        private IScriptEngine schemeEngine;

        public SchemeHandler()
        {
            var mgr = ScriptDomainManager.CurrentManager;
            var slp = new IronSchemeLanguageProvider(mgr);
            schemeEngine = slp.GetEngine();
        }

        public object Evaluate(string input)
        {
            return schemeEngine.Evaluate(input);
        }
    }
}

 

As in the example code, which complains that there is no constructor for IronSchemeLanguageProvider, and:

using IronScheme.Hosting;
using IronScheme.Runtime;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;

namespace IronSchemeTest
{

    public class SchemeHandler
    {
        private IScriptEngine schemeEngine;

        public SchemeHandler()
        {
            var mgr = ScriptDomainManager.CurrentManager;
            var slp = mgr.GetLanguageProvider(typeof(IronSchemeLanguageProvider));
            schemeEngine = slp.GetEngine();
        }

        public object Evaluate(string input)
        {
            return schemeEngine.Evaluate(input);
        }
    }
}
Which complains that there is no suitable constructor in IronSchemeLanguageProvider.

What am I doing wrong?

Thank you for your time,
Timothy Sassone

Coordinator
Oct 7, 2012 at 8:47 AM

Hi

This issue has come up before: http://ironscheme.codeplex.com/discussions/270961

What version are you using?

Have you tried one of the latest builds instead of a release?

Thanks

leppie

Oct 7, 2012 at 5:30 PM

I downloaded and compiled the latest build and still got the errors - I'll do some further testing and experimenting later, got a busy day, and get back to you once I have some more useful information.

Coordinator
Oct 7, 2012 at 5:51 PM
timothysdev wrote:

I downloaded and compiled the latest build and still got the errors - I'll do some further testing and experimenting later, got a busy day, and get back to you once I have some more useful information.

I meant grabbing a build from http://build.ironscheme.net/ :)

All you need to do now is reference IronScheme.dll and have the libraries handy that you wish to use (if any).

I just created a project in VS2010 (targetting .NET 4 I guess), and placed

Console.WriteLine("(+ 1 2)".Eval());

In Main().

Also added

using IronScheme;

And added the reference to IronScheme.dll.

There is no initialization needed, it will be done automatically.

 

 

Oct 7, 2012 at 9:25 PM

Ah!  Wonderful, that fixed it, thank you!