What is an embedded scripting language? - language-agnostic

What is an embedded scripting language? What are some advantages it would have over the domain specific language?
"A number of languages have been designed for the purpose of replacing application-specific scripting languages by being embeddable in application programs." -Scripting language (wiki)
Javascript.NET is one such example. It can be used in place of c# for example. However, what constitutes the difference between a scripting language, and an embedded scripting language? Moreover, why would javascript be more desirable than C# - or any other domain specific language?

An embedded scripting language would be a scripting language (or more specifically an interpreter for such a language) that can be embedded into applications. Thus, the interpreter has an API that can be used to integrate it into the application, allowing scripts to control all or parts of the application.
the advantage is that application developers only have to provide the interfacing with the language; they don't have to implement the actual language. This allows more complex and feature-rich languages to be used, since there's no development time (from the application developer point of view).
For users, it means they know the pros and cons, the quirks and benefits of the scripting language, provided we are talking about a commonly used one.

For your core business, you probably should not use an embedded language, but there are other upsides of using an embedded language. Most importantly, in my experience, it is beneficial to have an easy-to-use language on which other users can build against your system. While theoretically it is possible to build against your system with proper definition of interfaces, it is a lot more user-friendly to let inexperienced people play with JavaScript and Lua, instead of having to set-up an entire environment to deploy in .NET.
Of course, it is easy to hot-swap embedded languages and it can speed up your testing considerably; it is also possible to see your changes immediately without reloading your application, because you just reload a small virtual machine for that embedded language.
I personally employed this to allow people to write assisting scripts against a game.

Related

What open source web programming languages are more restrictive than PHP?

I learned some java first, and now I'm learning PHP. I am not comfortable with how "free" it is, with things like loose typing. I really liked the way java forces you into good practice. Are there any open source web programming languages that are more restrictive than PHP, in the same way java is?
How about... Java? :D
If normal Java-driven frameworks are (for some reason) unacceptable, then how about Google Web Toolkit - you write code in Java (with all the benefits of the language), but the application is compiled to JavaScript, which can be run on any modern browser. Additionally, it performs some optimization, etc - really worth looking into if you are familiar with Java and want to use that language to write "light" web applications.
If I didn't make it clear before: you write code in Java (you can use all the design patterns, object-oriented features, strict typing, etc., the compiler warns you if there are compilation-time errors, there's very mature Eclipse integration and so on), but the application is compiled to JavaScript - no need for Java plugin in the browser (no Java applets whatsoever). The compilation part additionally optimizes and obfuscates the output JS code so you'll get faster and smaller code, then if you wrote it by hand. The server side is up to you - while it is easiest to use Java there (especially with all the cool stuff coming in GWT 2.1), you easily use PHP, RoR or Django (via JSON or XML).

How to add bindings to a new language?

So you've got to create your own scripting language built in .NET C#.
What's better now for libraries? (think SDL/OPENGL), generate wrappers with Swig or do it by hand? Any other choice?
Since you're building the language in C#/.NET (which I will comment about later), you should have easy access to the entire .NET library system. This should make it very easy to use existing libraries to make .NET assemblies, and have them exposed to your scripts.
However, I'd question wanting to make a scripting language in C# - There are very good options out there, especially if you take the DLR (dynamic language runtime) into account. You can provide scripting to an existing C# application very easily without making a custom language.
I would recommend using the CLR.
This way, you get the entire FCL, and any third-party libraries that people write in .Net, without having to do any additional work.

Language for web site development C++ or php?

I want to develop a forum like web site. I know C, C++ well but I havent used in web development.I know PHP little bit. Which language should i use?
C++ can and has been used to successfully develop highly scalable web applications. That said, one of the main reasons C++ is not so popular in this category is to do with the lack of standard tools and libraries. There is simply no feature rich library which includes all the necessary boiler-plate code needed to write web applications.
PHP is everything that C++ isn't when it comes to web development - a high-level scripting language designed mainly for web development. The description of PHP on the homepage sums it up nicely:
PHP is a widely-used general-purpose
scripting language that is especially
suited for Web development and can be
embedded into HTML.
If you're developing a simple forum, this decision is a no-brainer: PHP. In addition to the obvious advantages to using it, you'll find the syntax familiar as it is C-like. However, if you have all the time in the world, you're feeling brave and this is for hobbies' sake, do it with C++!
Out of those, for web development, PHP for sure.
C and C++ is not the correct choice to develop for web, so if you know PHP it's better.
also you can try python, ASP.net etc...
To add most hosting does not support c++ and they will not in most case so if you were me I will go for PHP and almost(nearly) all hosting service support it.
Also the lack of function for web development in c++ is also a pull down.
Actually, I wonder why you're not considering to use both! Use PHP for the web interface and write special C++ methods for the more complex actions that you want to take. (Although PHP can handle most of those too.) Basically, this would require less knowledge of PHP and your C++ knowledge stays usable.
Do keep in mind the hosting restrictions of your webhost, unless you're going to host your site on your own system.
Also, do realize that the use of C++ for web development would restrict you to the more general C++ libraries. C++ can be used to write platform-independent code, just like PHP. But not all libraries are supported on every platform.
Finally, PHP already is a powerful language and there are plenty of add-ins for PHP that you can re-use instead of writing it yourself. Still, most of PHP and all the add-ins are written in C++, even though many people just forget about the fact that the code behind PHP had to be written in some language too. Image manipulation, encryption, complex math, etc... It's all been done before for PHP. But it should not stop you from writing your own extensions...
PHP, Python, ASP, JSP, C#.net all should work
C++ is not commonly used for this purpose. Most shared hosting providers won't allow you to run native executables created by C++ for reasons of security (though I suspect this would be manageable with fine-tuned rights) and portability (eg. you'd have to know which OS the shared hoster's webserver runs on and possibly install additional libraries).
Even if you have your own dedicated server with root access, it might still be difficult to properly integrate an executable as CGI into Apache or IIS.
If you're not bound to PHP or C/C++ for some other reason, you could also try C#. Picking up C# from C++ is very easy and ASP.NET allows you to write your complete website in C#. With ASP.NET MVC, you even have an MVC framework comparable in productivity to Ruby on rails. Many shared hosting providers support ASP.NET and through Mono, it's even possible to host ASP.NET web sites in Linux (I'm doing this with my blog ;-))

Language Agnostic API Generation

I am currently working on a design for a collection of subsystems, and I would like to be able to offer the API's exposed by a given subsystem for use by other subsystems.
In the past, I have used SWIG to expose C api's to a variety of other languages. This has worked well for me, but ultimately the API is defined in C. So basically one side of the API is language agnostic, and the other isn't.
What I would really like is to have something similar to SWIG that could generate the interface between 2 arbitrary languages based on some description of the API.
I don't want to use web services.
For example, I would like to call a 'function' from java, and implement the 'function' in Python. I'd like to be able to generate the language interop using a code generator.
Is there anything that exists which can do this today? At least for simple 'function' calls - ignoring the more complex cases like callbacks and situations where you need to maintain references outside of the 'function' call itself.
I found this after following gooli's link to Protocol Buffers .
This looks so compelling I'm going to propose it as an answer to my own question.
http://incubator.apache.org/thrift/
Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml.
From the whitepaper:
...we were presented with the challenge of building a transparent,
high-performance bridge across many
programming languages. We found that
most available solutions were either
too limited, did not offer sufficient
datatype freedom, or suffered from
subpar performance
Also from the whitepaper:
A. Similar Systems The following are software systems similar to Thrift.
Each is (very!) briefly described:
SOAP. XML-based. Designed for web services via HTTP, excessive XML
parsing overhead.
CORBA. Relatively comprehensive, debatably overdesigned and
heavyweight. Comparably cumbersome
software installation.
COM. Embraced mainly in Windows client softare. Not an entirely open
solution.
Pillar. Lightweight and high-performance, but missing
versioning and abstraction.
Protocol Buffers. Closed-source, owned by Google. Described in Sawzall
paper.
The last part about Protocol Buffer's is out-of-date - its been open sourced
COM (and to a lesser extent Firefox's XPCOM) might be what you are looking for. In COM, you define the API using a language called IDL which can then be compiled into different languages. When using the same language the calls usually degenerate into efficient function calls.
However, COM is a very complex and dying piece of technology that I would never use for a new project.

What is meant by framework, programming language and scripting language?

What is meant by framework, programming language and scripting language?
I think Daniel Pryden's points are excellent - I voted him up. I'd just like to add a couple of minor additions.
Programming languages, like C and C++, used to have a compiling and linking step that rendered the source code into a machine-language form that was run by the operating system.
Scripting languages, like the Unix Bourne, Korn, and C shell, were not compiled or linked like C and C++. (Thanks to Daniel Pryden's correction and citation of the Unix scripting languages.)
Since virtual machines have become so common in languages like Java, Python, and C#, the distinction between scripting and programming has been blurred.
As for the distinction between libraries and frameworks: your code links in libraries and calls them. This is different from a framework, because your code is plugged into the framework. It's known as the Hollywood principle: "Don't call us, we'll call you."
The distinction between programming languages and scripting languages is ill-defined. In my opinion, we should dispense with the term "scripting language" and just call them all programming languages.
A framework, on the other hand, is a collection of code that uses an inversion-of-control mechanism to help you structure your code. Frameworks are similar to libraries in that they provide building blocks you can use to build a bigger system.
Frameworks are libraries or templates of pre-written stuff you can re-use. They often come with a pre-imposed structure and philosophy of how to approach a domain of problems.
Programming language is a superset of scripting language and includes anything you yourself write that makes a computer do something.
Scripting languages are traditionally interpreted meaning they are useful for smaller more light-weight purposes, but that definition is getting vaguer since JavaScript - a 'scripting language', for example, is not interpreted so much these days.
Framework is a combination of class libraries and runtime environment to execute code by independent on operating system. It is placed on operating system, mask functionalities of OS.
Scripting language is a language, it has script nothing but a support to another language its not used individual, like JavaScript, asp.net server side scripting, these are all give support and prompting to other languages, like JavaScript give prompting to html.
Programming language is instruction to computer and then computer execute that one
Framework is a combination of class libraries and runtime environment to execute code by independent on operating system. It is placed on operating system, mask functionalities of OS.
Scripting language is a language, it has script nothing but a support to another language its not used individual, like JavaScript, asp.net server side scripting, these are all give support and prompting to other languages, like JavaScript give prompting to html.
Programming language is instruction to computer and then computer execute that one