As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is ActionScript a scripting language or is it more an object-oriented programming language like Java? A quick check on Wikipedia lists it among scripting languages...
AS is a variant of ECMAScript. you can say it's a dialect of JavaScript.
as such, it has and has always had, OO qualities. it's not 'more' OO in 3.0 than before, it's just more "java-OO like" than before. because now it includes language support for class-based inheritance.
of course, the usual prototype based inheritance is still there, and it's a superset of class-based style.
and nothing of this makes it any less 'scripting' than before.
Although it is called Action"Script" it is an Object Oriented Language very Java-like. All code gets compiled into a binary swf file.
ActionScript 1 also was OO based on prototypes.
ActionScript 2 adds classes, accessors, etc but this is pretty much syntactic sugar on top of AS1.
ActionScript 3 is completely redesigned and runs in a new virtual machine (AVM2) inside the Flash Player in parallel with the old virtual machine.
It's a variant of EcmaScript, so it's akin to JavaScript.
ActionScript
The two are not mutually exclusive.
The structure of the later AS versions are object-oriented, however it is not compiled into native assembler. It is instead interpreted as byte code.
Who says a scripting language can't be OO? I'd say it's both a scripting language and OO.
I mean, for instance, Python is often called a scripting language, and can be used simply to script existing applications. It's also OO. Both can in fact be merged if the software in question, say, requires you to pass in an object that adheres to a certain interface.
what distinguishes Java from AS3?
Not a lot. Both generate bytecode that gets passed around, then compiled to machine code on the target platform through a JIT.
While AS3 is commonly described as belonging to the EcmaScript family, it has 2 co-existing object models under the hood. One is the traditional prototypical approach, while the other is a much more java-like approach, with packages, classes and interfaces, subclassing, abstract and final methods, etc.
Similarly, AS3 can be used without any explicit typing (just like javascript), or it can be used with strong typing, like Java. Unlike AS2, any type information given is encoded in the compiled bytecodes, and verified at runtime.
Note that the default compiler settings encourage developers to go toward the java-like flavor, but it's nothing that can't be fixed with a few options.
Essentially, ActionScript evolved from a toy language (See Flash 4 and below) to an javascript-like language (Flash 5 and 6), to an ecmascript language pretending to be something else (Flash 7 and 8) to something that has now more in common with Java and C# than with its own older incarnations (Flash 9 and 10)
To go back briefly to the original question, I can think of two language features that almost every scripting language has, that AS3 lacks:
The ability to run a script from source directly. AS3 requires an explicit compilation step.
The ability to evaluate a string at runtime as a code fragment. Don't look for an "eval" statement in AS3, it just doesn't exist.
AS 3.0 can be written as OO. Previous versions are more JavaScript like and procedural.
Someone described ActionScript to me as an event oriented programming language. AS3 is a scripting language with OO features.
Without defining what you mean by scripting language nobody can answer this question.
As Larry Wall puts it so well in Programming is Hard, Let's Go Scripting... :
"I think, to most people, scripting is a lot like obscenity. I can't define it, but I'll know it when I see it."
and
"But basically, scripting is not a technical term. When we call something a scripting language, we're primarily making a linguistic and cultural judgment, not a technical judgment."
I think it might depend on what version you are asking about. I am not an actionscript expert, but it looks like the designers are trying to make it an object oriented language. I think with 3.0 they have effectively made the jump (at least partially) to an object oriented language.
OK Thanks for the input guys, the best answers seem to be AS3 is both an OOP language and a scripting language. I guess this goes back to the definition of a scripting language - are scripting languages compiled? I have been equating AS3 and Java because both are compiled to byte code and run inside a VM, but I never hear java referred to as a scripting language, I guess I am still a bit confused...
I guess my question is now what distinguishes Java from AS3?
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm building a new game and I need to build a web app to help manage content generation. The app would consist of a couple simple forms that would tie into a MySQL db.
I've been really interested in learning Lua for a long time due to it's large popularity in the video game industry and was wondering how well it works as a server side language. I could easily write the web app in PHP but I'd rather use this opportunity to learn Lua if it makes sense.
What do you all think?
Cheers,
Sure it can be done. Good idea if you just want to learn Lua. You should start here: http://www.keplerproject.org/
Of course, if your app would consist of a couple simple forms, you can use all what you want. But if it is more complex (will become more complex in future) it will be better to use some industry standard languages like Python or Ruby (or, at least PHP), there are a lot of good frameworks writen in them that very simplify your work (I don't know about any complete lua web frameworks) .
You should remember, that in future other people will have to maintain your code and there are very few web-developers who know Lua.
Probably, there will be problems with documentation and basic libraries too.
While LUA is a nice language for embedded development but i would extremely vote against LUA for web development.
The reason is that in Games you simply don't have an external API. All is done with your own objects only some calls into your game engine.
But the web world is so full of stuff you need, like SMTP, POP3, IMAP, SSL, Amazon APIs, Google APIs, RSS Apis, Imaging etc. and while the checklist for LUA may have a check mark behind all this words - it doesn't mean anything. Most of the stuff i have seen is just a "me too| implementation but not industrial strength. They are projects by hobbyists and are published on a "Its good enough for me" basis which is total unacceptable if you ever go mission critical.
There is a reason why it takes years and a huge community to get this up. Lua has an extremely small community of web developers.
So if this is a professional project where you put your money i can only say hands off. On the other side if you have enough money i still have some snake oil here for sale, please contact me.
I have been using lua for years as a web language. Initially using the Xavante project and more recently apache2.
Dont listen to any neigh sayers, its a great language for web developement and we use it to write business software, and not just for form processing, for graphical applications too.
Also it offers us seamless integration to any other lua or system functions we might need to call.
Good Luck!
Have a look at Nanoki which is built on a pretty minimal set of libraries (lfs, luasocket, lzlib, slncrypto)
and Sputnik which is built on Xavante or CGI
Lua is a good language but it is best suited to embedding within an existing project in order to quickly extend the capabilities of that project. In particular, the interesting aspect comes with how you bind it to the host application. This is definitely the case when programming for games where it is an embedded language rather than the language the whole app tends to be written in. So using a web app to learn about Lua with a view to making games is probably not a very good approach, especially since the syntax is very simple and would be picked up quite quickly anyway.
I think that specific variants of lua can be used successfully for web applications and I have done that in the past using the maintained weblibrary. It can depend on if the lower level software on the computer is itself written in lua because of its high speed and this may cause a clash of lua versions. Regarding a serverside possibility the server would need a compatible version of the script developing facility for the hardware and a suitable bytecode or VM instructions and custom VM runtime implementation for running the application.
I've been developing a pure Lua Web Server, you could always check it out and see if it suits your needs
Lua4Web https://github.com/schme16/Lua4Web
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I'm ASP.NET developer. I want to learn web development technologies and other languages than Microsofts.
I heard about two languages but I don't know which one is better or how to favor one over the other especially that clojure is new somehow.
Could anyone help me about why to choose one of them over the other?.
Thanks.
Ruby will obviously give you a better bang for your buck if your aim is to get things done and to reuse mature libraries. It must have one of the most vibrant ecosystem considering web development. The quantity of new stuff is big and, most importantly, the quality is often amazing.
It has a very nice package distribution system, and a number of tools which makes practical web development a breeze, at all levels.
In the heavyweights web frameworks you have:
Rails, which you have necessarily heard about. It is probably one of the best compromise today between big community and intelligent design. The other one would be django in my opinion but it is a python framework
Merb, which is a lighter alternative in the full blown framework department
And you have a ton of lighter ones, like Sinatra , which is probably one of the most elegant small web framework i have ever seen, or Camping, which is small and very fun to use.
This is only the beginning. Be it for ORMs, templating engines, or anything else you'd want to do with it web related, you have a ton of quality options.
On the negative side for ruby:
It is a very dense language, with a lot of things to learn, and a distinct inclination for "magic" constructs. It is quite beautiful, but it is far from the simplest language.
It is slow. If you want to do anything that needs performance, ruby is probably not the language you need. That may or may not be a problem depending on what you want to do with it
It doesn't have as many library for "regular programming" than it has for web programming, although it is clearly not the desert either. A language like python has a more wide range of libraries if you step out of web programming though.
Clojure is a very different beast altogether. It is a very new language, and it is entirely functional. If you never programmed in a functional style before, it may be a paradigm shift that will make you less productive for a while, but you will almost certainly learn a lot in the process.
It is also a lisp, and like with functional programming, it will probably mean a lot of new things to learn, but a lot of enlightenment at the end of the process.
It is a very elegant language, with a very vibrant community. It is also a lot faster than ruby, and it is only getting better with the new 1.2 version.
So on the positive side :
It is a clever language. Contains a lot of interesting ideas, notably regarding concurrency. It is not object oriented
It's fast for a dynamic language
It runs on the JVM, and has a very strong and easy to use interop system with Java. That basically means you have the whole Java ecosystem to your disposal.
On the negative side :
It is very new. That is not a disadvantage in itself, but is the reason for other troubles you might have with it along the way.
It has very few well integrated and thought libraries. This is the point that is the most detrimental in my opinion. You basically have everything you will ever need in java world, but the solutions may be ugly. You might want to code your own wrapper library in the process, but this takes time.
It is not like everything you know. It's not object oriented, it is not imperative, and it hasn't anything like classical C syntax. So depending on your other language experiences, it might take a long time to learn
So the summary is :
If you want to learn new things in a very comfortable environnment while having the possibility to build things very fast by leveraging mature libraries, choose ruby.
If you want to learn even more new things, you don't mind in totally new territory, eventually taking more time to do things, and you want to participate to a community that might be on its way to modify the way we think about programming, while hacking and having fun in the process, choose clojure ;)
Switching from ASP to Ruby is probably easier than switching to Clojure, also it has a larger community and ecosystem. However, if you are interested in functional programming and/or fancy concurrency features, you should give Clojure a shot.
Ruby is a nice language though I'm partial to the Django framework over Rails. One thing that I have found working with interpreted languages is their ambiguous implementation of threads. In both Ruby and Python the interpreter will only crunch though one thread at a time.
As far as clojure goes, think about how big the library will be when you try to use it. Coming from .Net you already have a huge lib. Python and Ruby are fairly mature at this point, and you can find most any extensions you could imagine. It is so easy to take a big library for granted until you don't have it. Before switching look at .Net nuke. Haven't used it but it's supposed to be model/viewer layer for .Net.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I don't believe seeing this. It says:
For April, Chris Smith will be presenting on writing a Java to x86 Compiler in F#.
The presentation may go on for an hour or two which definitely is not enough to write a compiler. I've heard that F# is powerful, but this powerful?
Well, all I wanted to ask is this: Can you write a compiler in F# that quickly?
Let's first start with a few corrections:
It's not a Java compiler, it's a compiler for a small subset of Java.
It doesn't say anywhere that the compiler will be written in the time, only that it will be explained.
In fact, it doesn't even say that, it says, it will be presented. Heck, I can present GCC in 3 minutes. It's not gonna be a very useful presentation, but it's gonna be a presentation.
That said, explaining a well-structured, simple compiler for a simple language implemented in a language which is well-suited for writing compilers within an hour is definitely feasible.
F# is a member of the ML family of languages (specifically, a close cousin of OCaml), and those are indeed well-suited for writing compilers. In fact, the reason why Robin Milner chose the name ML (meta language) for his language, was because it is specifically designed for writing compilers. A compiler is basically a big function (thus making it very natural to implement in a functional language) that detects patterns (thus making it very natural to implement in a language with pattern matching) and executes a little bit of code for each pattern it detects (thus making it very natural to implement in a language with first-class functions). And whaddayaknow? F# is a functional language with very sophisticated pattern matching facilities. Another nice feature is an expressive type system with algebraic data types and discriminated unions which makes it very easy to represent Abstract Syntax Trees.
At the Lang.NET Symposium Jason Olson gave a talk on F#, during which he showed some pieces of an interpreter that he is currently working on that demonstrate these features very well.
Fredrik Holmström is currently working on IronJS, an ECMAScript 3 implementation for the Dynamic Language Runtime. Take a look at the code, specifically the AST types and some of the analysis and parsing code.
Jonathan Tang's Write Yourself a Scheme in 48 Hours is another good example of writing an interpreter, this time in Haskell which shares many features with F#.
The 90 Minute Scheme to C compiler by Marc Feeley is a presentation about a Scheme compiler written in Scheme.
In Implementing Scheme in Ruby, James Coglan teaches the audience Scheme, live-codes and explains a Scheme interpreter in Ruby and writes a couple of sample Scheme programs, all in 15 minutes.
Giving a presentation about a project isn't the same thing as implementing the whole project during the presentation.
It's perfectly possible to present some interesting aspects of a Java to x86 compiler within an hour, and even show some code: but that's not the same as creating all the code then and there.
Java is a fairly complex language, so I suppose that Chris isn't going to implement a complete Java compiler. However, his talk really points out that manipulating with code (and tree-like structures in general) is much easier in F# than in any other .NET language. That's why F# has been used in various static analysis tools (e.g. Microsoft's static driver verifier)
Tools like fslex and fsyacc make it easy to write parser for a language. Chris has a blog with simple mathematical expressions. Robert Pickering wrote a more sophisticated example that actually generates IL code (compiles mathematical expressions to .NET) in just a few lines of code. This can be even easier on .NET 4.0 if you generate code using Expression Trees.
So I suppose that even if he was writing the compiler from scratch, he could write compiler for a langauge that can be used to write non-trivial sample programs.
Can you write a compiler in F# that quickly?
I have written two tiny compilers in F# over the past week, each in about that much time. So yes, it can be done. Here is one of them.
Note that the ML family of languages that F# is descended from were specifically designed for this application (metaprogramming).
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 13 years ago.
Will F# ever be a mainstream language like C# is? Or will it remain a niche language?
Do you foresee any clients coming to you with projects executed in F#?
Will a professional programmer be able to make a living from F#. What sort of demand do you predict for F# programmers?
Kind regards,
There are people making a living out of functional programming today. For examples, see the commercial users of functional programming workshop which is being held each year.
For the first version of F#, Microsoft is targetting engineering, mathematical, financial and data-processing applications (if I remember correctly). Whether that is a niche or not depends on your perspective :) but it seems like a reasonable market.
Thanks to F#'s excellent .NET integration you can, to a large extent, choose to make your projects using F#. What should your client care. If you get a competitive advantage from that with respect to C# programmers, maybe you'd better hope F# does not hit the mainstream...
Lastly, certainly F# (and Scala) are indicators that at least functional programming will become "more mainstream". But when is a language considered mainstream? I wouldn't be surprised if there are many many more lines of code in C and COBOL out there than C#,VB and Java combined. So from a C programmer's perspective, C# is a niche language. I think programming languages, thanks to virtual machines, are becoming more diversified in general (think also Ruby, Python and Haskell, for example, not taking into account all the smaller languages like Clojure, Ioke,...).
I can't answer this for sure. Certainly it's highly subjective. We can just wait and see what happens. But one thing is for sure. Even if F# remains a minority language, ideas and functional style of programming will be further added to other languages gradually. You can't say C# 3.0 is the same as C# 1.0. It's just a matter of name similarity.
I don't think that F# will ever reach the popularity of C# or other imperative languages because most applications are designed imperatively and most programmers think in this way.
But F# provides many very interesting features like LOP, compiler compilers, computation expressions (async workflows), quotations, units of measure.
Many problems can be formulated much better and more concise in a functional programming language (look at those F# examples using async {} or seq {}) and because F# is a bit more mainstream than e.g. Haskell (it has got the .NET framework that simplifies many tasks and is not purely functional!), it will be easier for many programmers to get into functional programming and learn it's advantages.
In addition, it's harder to write wrong code in F# than e.g. in C because you have good type checking, many strong types infered by the compiler and immutable values - You can intuitively prove the correctness of a functional algorithm which is often hard in an imperative one. Just think of this code which should count the number of zeros in an array:
int countZeros;
for (int i = 1; i <= length; i++) {
if (data[i] = 0) {
countZeros++;
}
}
This all are factors that will bring people to use F#. The rest is marketing (Microsoft should have a F# Express Edition in VS2010!!)
I can't see functional languages as a whole becoming mainstream. Ultimately anything that is alien to a mere mortal human way of thinking is never going to be mainstream.
Functional programming will however be more than niche. Its benefits in terms of expressing a problem that can be solved over multiple processors is compelling. What I see is F# libraries for specific purposes and/or F# concepts migrating to C#.
I'm not the expert but I think one of the advantages of functional programming is the relatively painless approach to parallelism and multicore processing. Therefore in a view of the recent Microsoft announcement in this area, namely Axum http://msdn.microsoft.com/en-us/devlabs/dd795202.aspx which is an another approach to parallel programming, I really doubt that F# will ever go mainstream. If Axum is adopted, it will be probably integrated with C# (like Code Contracts moved from Lab to C# 4.0) and F# will be used only in very specific domains.
I don't see it happening until Functional Programming going mainstream.
OTOH, if you take up F#, that's one more mainstream programmer on-board....
Avoiding it is a self-fulfilling prophecy.
The great thing about F# is the powerful combination of programming paradigms it allows. You can write most of your program in the functional style - brief, elegant and free from side effects (common bugs). But when you encounter a problem you can't solve functionally, you can then enter a short section of imperative code to get past it. It's also very easy to mark sections of your code as asynchronous, and it will then run in parallell if you have multiple cores/processors. The solution will be much easier than a C# equivalent. After witnessing a demo by one of the creators of F#, I was left with the impression that they have managed to extract great features from both Python and Erlang. F# will probably be fronted as the .NET answer to these two classes of languages and could eventually achieve a comparable degree of mainstream adoption.
In line-of-business development, it will never happen. It is simply too hard, so the average LOB developer will never be able to maintain it. In higher-end software companies, it could happen though.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
As I'm riding the wave of resurgence of Smalltalk (especially because many Ruby-on-Rails people are rediscovering Smalltalk and seeing Seaside as their next upgraded web framework), I get questions like "yeah, but how do I use my favorite editor to edit Smalltalk code?" or "Does Smalltalk still insist on living in a world of its own?".
Now, having first experienced Smalltalk back in 1981, I don't understand these questions very well. It seems rather natural that I'd want the editor and debugger to be savvy of my current code state, and integrate with the change control system that is Smalltalk-aware. Using an external editor or debugger or change control manager would seem very awkward.
So what is it that scares you the most about not being able to edit the five-line methods in Smalltalk with your favorite editor, or use your favorite non-Smalltalk-aware change control system?
Everything's different. Want to go to the end of the line? It's not Ctrl-E. Want to jump a few words over, by word? It's not Meta-F....
Text editing is a fundamental programming activity. Messing with those inputs is messing with something deep in my mind.
Edit: and here is someone asking for emacs key bindings on comp.lang.smalltalk in 1987.
The only Smalltalk I've spent any time with is Squeak, so my views may not apply to other Smalltalk environments.
What concerns me about the image-based approach is that, while you have wonderful things in the Smalltalk environment, it is a walled garden that makes it difficult to interoperate with anything outside that environment. For example, what if I want to use external tools like Yacc and Lex? What if I want to use some C or Python programs to generate Smalltalk code? What if I want to mix Smalltalk in with a bunch of code written in other languages, editing code in all those languages in one editor and keeping it all stored in the same source-code tree?
I'm sure it's possible to deal with all these issues by having your Smalltalk environment invoke system functions to control external tools. But how easy is it to let external tools control your Smalltalk environment? In other words, what if I want Smalltalk to be just another component, rather than the master of everything?
Nothing scares me in particular, but I found working out the API's in VW a bit of a chore, even when I had used other smalltalks. The effect of the browsers is that you tend to see the API's a little bit at a time and quite often it's not immediately obvious where you should look for particular functionality.
Smalltalk also suffers a bit from the paradigm shift to understand how it works. When I was doing my bachelor's degree at university (some time after I had first encountered Smalltalk) I got to enjoy a bit of Schadenfraude watching everyone else in the class getting over the initial paradigm hump as they learned the system (Squeak) for the first time.
I think the combination of the paradigm shift and functionality being somewhat buried in the class libraries makes for a bit of a steep learning curve. ST had a reputation for a fairly steep learning curve to really come up to speed - most of this is due to the large class libraries and the fact that most of the language functionality is buried somewhere in the libraries.
Also (and sadly), Java came along in the mid 1990s and grabbed all of the mindshare. The major Smalltalks have either died completely or been sold off to niche players. It's quite Ironic (in a happy way) that Ruby has served to re-awaken interest in Smalltalk but the lingering perception of 'also-ran' obsolescence doesn't help.
See This post of mine for some pontification about the merits (as I see them) of getting heavily involved in Smalltalk in this day and age.
I would be quite happy to go back into Smalltalk if the opportunity were to arise.
The one big show-stopper for me is that code I write one Smalltalk VM is STILL, after all these years, not compatible with other Smalltalk VMs.
I understand why that is: the core of Smalltalk is an extremely small set of axioms and keywords. This means that after 30 minutes of learning Smalltalk, you're already learning the API library rather than the language itself. I like that approach to language design.
What it all boils down to however, in the Smalltalk world, is that unless a consensus is reached between all VM vendors to have a common base Standard API, my Smalltalk code written for one VM is almost certain not to run on other VMs when I decide to switch.
This also has the corollary of obsoleting part of my knowledge of the space when I switch VMs.
Note that I have barely tried Smalltalk in my life. I'm far from being an expert. This understanding comes from speaking with James Robertson about a month ago.
Another point I'd like to make is that Seaside does in fact run on most popular Smalltalk VMs. I wonder how much of (what should have been) a Standard API they had to build for themselves to achieve that feat.
With all that said, I always have an ear out to hear more about the state of Smalltalk. I do want to try out Smalltalk's very powerful development environment (and its other goodies).
I know it's late but the biggest annoyance for me is that there is not really good editor in none of the smalltalks. It's a thing I can not understand. Working with text is so essential and that less "supported"....
It's always this just staring at one method and then you need to have some method finder or another browser around just to check another method. This is what I really dislike....
While the restricted Smalltalk environment made things like relying on a database driven source control system possible at times where other languages still struggled with having a proper editor, it makes integration very hard in todays times.
With tools like Eclipse or Team Foundation Server you get so used to having all tools integrate with each other. E.g. if a requirement is created, it is automatically linked to the change sets that the programmer commits to implement that requirement. This "boundary breaking" between formerly different tools is nearly impossible in the Smalltalk world, but with bigger projects, bigger teams, higher levels of abstraction and so on you need tools which are more than a fancy editor and help you throughout a full software development life cycle.
No useful support for navigating with the keyboard, or supporting platform UI behavior.
While it's true you don't really need an incredible text editor for (well-written) Smalltalk, being able to move around the environment while keeping your hands on the keyboard is quite useful (and in my case, essential to reducing RSI). I just was trying VisualWorks' inspector and the arrow keys didn't even work properly to move up and down a list. When I hit the space bar, I got a walkback. Sigh.
For the Windows world, there is nothing like Dolphin Smalltalk. The IDE is fantastic. Another quality product if you want to try is Visualworks, it works well, has a very fast VM and the documentation is pretty good.
I've used both in the past, there is nothing to fear.