Should I use Lua? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am going to work on my new project where client has demanded to use 'Lua' if possible, I have never used it before and by searching on it I found it is fast compare to javascript and getting popular nowadays.
As I am very confused I had never use it before so I want to know something
Is it really better(in terms of performance and use) then javascript?
Will I get enough resources(because I don't want to move over after starting development due to lack of resources or it becomes hard to me develop)?
Will it needed anything other than C compiler to run?
Please guys it is really important to know about such thing before starting. Any help will be appreciated.

I'm assuming you're writing a standalone application in C or C++, and you're looking for a language to enable people to extend that application by embedding another language. That's pretty much Lua's territory.
Lua's strong point is that it's very easy to embed in your (C) application. It compiles quickly, it's tiny, licensing is liberal and using C functions from Lua is relatively easy. Standard Lua has enough performance for most things you'd use a language like this for; if you need more raw speed you could look into LuaJIT, the JIT-compiler for Lua.
As for your questions:
LuaJIT will probably be pretty much as fast as you can get for a dynamic language. Lua is used in games (Sim City, Far Cry, World of Warcraft), where performance is very important.
If by 'resources' you mean documentation: sure. Lua is a very simple language, much simpler than JavaScript; the manual should help you get started with the language itself, the wiki is tasty for tips about the embedding process. This article has an example you can copy/paste.
Lua pretty much runs everywhere a C program will run. It doesn't even need an operating system, and it doesn't depend on anything at runtime if you bundle it correctly.
Embedding a full JavaScript environment in your application, and interfacing your application to the JS environment, can be a lot of work (even though Google's V8 engine has some functionality to help you; see here).

Related

Opinions welcome: Why MEAN stack and Node.js? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am curious as to the fundamental reasons why we choose MongoDB, Node.js, Express.js, and AngularJS?
Here are the reasons I can think of:
MongoDB works well with JSON and data models, is faster than SQL;
Express and Angular gives the stack one language in Javascript;
Node.js is non-blocking, event based, and supports concurrency;
Angular is a wonderful front end framework.
Any other reasons? Also, how would you address the people who have an innate disdain for server side Javascript?
Thanks!
Well, people wanted to replace the LAMP stack (Linux, Apache, MySQL, and PHP/Python/Perl) for a very long time. When JavaScript was made possible to run on the Server side ie NodeJS, it paved way for a full development stack which is the MEAN stack.
The first advantage of the stack is the single language throughout the whole application - JavaScript. This made it easier for a person with JS knowledge to create a full on working application. This also made way for front end developers to explore more into how server side programming works.
Some startups and organizations thought that using a stack with one language will help them in limiting their resources. And easy delegation of work among the developers.
Even though MEAN stack is an awesome alternative to the traditional LAMP stack, it is still in its early stages. It is adopted only by few ambitious startups, but not by bigger organizations. They are still sticking to the legacy technologies. Also the components of the MEAN stack which is Angular, Express and Node are still in their childhood stages. There are no proven and complete use of the MEAN stack on a full scale solution.
Well organizations like Walmart etc. used Hapi.js and were successful in it, it tempts the other organizations to go forward with it , but also makes them skeptical on using it since replacing the already existing technology will be a bigger headache.
Also since a lot of the current employees are trained in Java, Python etc, developers in JavaScript are very few and JS is almost considered as an additional language to be known for a Java developer and the likes. JS hasn't been considered as a single language on its own.
Maybe few years down the line, the MEAN stack will prove itself a noteworthy alternative to the traditional stacks.
I work in the Retail Domain and a big organization. We are actually planning to use the MEAN stack for our inside projects. But no one ever gave a simple thought of using the MEAN stack in PROD.
EDIT: One more important reason these stacks are tempting is because they are all Open Source. Say MongoDB for example. Owning the software license every year is a big hit on the profits of the organizations with DB's like Oracle SQL etc. Going with an Open Source DB is a very cost effective option. But still they are skeptical on using it for Production.

Is there a reason to use Scheme over JavaScript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
As far as I know, JavaScript can be used to do everything that is possible in Scheme.
Every functional programming paradigm I've learnt in Scheme is doable in JavaScript.
I know that one may end up using JavaScript to write ungood code (ones with global variables, too many states and side effects) where as Scheme restricts one to write functional code.
But apart from that, is it really necessary to use Scheme anywhere over JavaScript?
For those of you who say JavaScript can be interpreted only on a browser kindly draw the same question to Python and Scheme.
Let me pose a similar question:
Is there a reason to use French over English? Anything that you can express in French you can express in English, so is it really necessary to use French over English? Kindly draw the same question to Russian, German, Spanish, or any other spoken language you choose.
No programming language is completely unique, anything you can do in one language can be done in a different language, some implementations might require a bit more creative thought but it can still be done.
Some reasons to use Scheme instead of JavaScript or Python:
You appreciate the simplistic and minimalist structure of the
language
Ease of implementation when compared to expressive power (lambda
expressions)
You are more familiar with Scheme
The client has existing code in Scheme
Specific implementations or algorithms might have a min/max calculation available to give exact benchmarks, but you would have to look at specific algorithms. In general there is no way to define one language as always better in all situations (or even 'never worse'), and trying to pigeon hole oneself into a single language is dangerous. In my opinion, open mindedness is one of the biggest strengths a programmer can have. Being able and willing to use different languages or techniques can be a powerful tool.
I personally suggest further reading by looking up Polyglot Programming. It isn't directly related to your question, but it is a mentality that speaks to the benefits of knowing and using a variety of languages.

NodeJS as an avenue towards learning JavaScript [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm a backend programmer who works mainly in Python. I'll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably proficient in JavaScript. It seems like a language that is wearing a lot of hats nowadays, and if nothing else, I'd like to a little more knowledgable about 'their world' when I'm working with front end guys.
We're using NodeJS for some server side work at my company, and I was curious about it. I've found a few good tutorials and it seems interesting. It seems like it might be a good way to familiarize myself with JavaScript, since it comes at it from an angle that I understand -- server side programming.
But I am also a little worried that if I learn both at once, I won't be able to keep track of what's 'Stock JavaScript' vs features that are particular to NodeJS.
What do you guys think? Is bootstrapping myself into JavaScript familiarity by learning NodeJS a good idea? Or will I just confuse myself if I jump into Node without a solid understanding of the fundamentals of JavaScript?
If anything, the potential problems will be in the reverse: NodeJS is closer to 'true' JavaScript (as in ECMAScript 5) than you can reasonable program on the client side, where lots of native javascript features have to be avoided and re-implemented with libraries.
It's easier to learn Javascript in node because you aren't dealing with HTML, DOM, etc and can treat it like "just another language" - this is what I did.
Node doesn't "add" much to JS, unless you count using CommonJS modules, but that's more of a library and conventions than syntax.

Learning JavaScript by reading first or writing first? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I did check (and read) a few similar questions here, but this really applies to everyone differently since no one learns the same.
My question is not on what resources to use, for that I have plenty.
I am working my way through JavaScript: The Definitive Guide (and I have the good parts as well).
I'm reading up on the core language but I don't feel like the information is sticking (or rather I'm not getting much out of it).
My question is should I just write an application in JavaScript and reference my books (I'm a very hands on person, but do enjoy reading), or should I keep reading the book, do the exercises, and then write a program?
In short: should I just write js app first and reference my book, or read the book first doing the examples and then write a js application? I've done some basic programming in PHP/Python (nothing meaningful yet).
I always learn math this way and I suppose, I'm conflicted in how I should tackle learning a language. I feel like I could read many books, but perhaps this isn't the best way for me (I know others learn differently).
For starts, I'm considering writing a simple calculator in JS.
Like for any languages I would suggest to do both.
You have to immediately start applying what you are studying. This way you will focus what you learned and understand better how the language works.
JavaScript is a highly flexible language. You can start soft, then learn new things each day and it will grow with you. You will never stop learning with JavaScript because it's easy to start but difficult to master.
You can start with really small scripts. When you start to feel confident you can create more advanced scripts, start using frameworks, write plugins for them, and ultimately your own library of functions.
I only suggest you to start learning best practices as soon as possible, because there are many things you have to avoid while programming in JS.
Then as a last word, always do what you feel like is better, don't go crazy trying to learn everything immediately. Everyone learns and works at his own pace.

Tutorial or Book on implementing a metalanguage in Javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I've been working in Javascript and PHP but I find that the hardest part isn't the implementation but the design of the webapp architecture [as usual . . .] In that direction, I wanted to create a sort of meta-language that takes PHP code as input but outputs JavaScript code thus making the design and implementation phase less painful [s.t. similar to GWT, Google Web Toolkit]. I found writing the this interpreter from scratch [parser, lexer, . . .] a viable option but an long one. Then I came across Processing.js [a library created by John Resig] where the user actually write java-like code that is transformed in Javascript by Processing.js then evaluated. I've searched the web for tutorials that introduces this powerful Javascript capability but didn't find even one! Can anyone PLEASE help me with any link, book title where I can get a least an intorduction? Thanx for your response!!!!
I would say your best deal would be to go with Haxe.
Haxe is a language that is designed to target (be exported) into the following platforms:
JavaScript
Flash
PHP
C++
Making it a very powerfull resource when creating web Apps as you can write in Haxe and have all your code ported to JavaScript, Flash, PHP or C++ without hassle.
Honestly, I think processing.js is not suitable for what you want, it was made to deal with the new canvas element, not the webpage.
Also, I think (honestly) think it sucks. They parse processing using Regex, it is totally wrong, you can't parse a programming language using Regex.
There is a javascript compiler compiler, called JS/CC, it is very easy to use, just learn the grammar and you can make a simple programming language.
But if you wanna make a complicated language (like processing, or php) by yourself, get ready for the nightmares.
PS: You'll need to know Javascript to implement a programming language in Javascript...
How about creating some PHP-functions that generate JavaScript-code? I do not think that you really need to write an interpreter for a custom script language. Ruby on Rails used to generate some JavaScript with simple Ruby-code, for example.

Categories

Resources