why don't more programming languages have builtin interfaces to the window manager? - automation

Programming is at the heart about automating tasks on a computer.
Presumably those tasks would normally be done manually by a human.
Humans use the computer through the keyboard, mouse, and interaction with the console or the window manager. But very few languages have built in functions that provide an interface to these basic computing objects.
A notable exception is autohotkey, an open source language on windows, providing builtin functions that allow the following simple tasks:
* Get Pixel Information
* Get mouse position
* Keyboard macros
* Simulate key strokes
* Simulate mouse click
* Window management
See examples on rosettacode.
There have been various attempts on linux, many of which were stopped without explanation.
One is the inactive tcl library: android. Search google code for android, lang:tcl

I write web server code. No human being interacts with the code. It's simply a lot of complex plug-ins to Apache.
"Humans use the computer through the keyboard, mouse, and interaction with the console or the window manager. "
This is completely false in my case. The "user" sends requests through HTTP. No keyboard, no mouse, no console, no window manager.
The user may be using some kind of fancy GUI, but it doesn't matter to me or my software. All I see are HTTP GET and POST requests. Pure text.
"But very few languages have built in functions that provide an interface to these basic computing objects."
Correct. I have no use for keyboard, mouse, console or window manager.

All personal computing platforms have libraries that will do this.
The problem is that that would require standardizing user interactions over all systems. Java tried this, without a great deal of success. There have been other libraries with more or less success, Qt probably being the most promising one to date.
It's certainly possible to write a language for a single platform that will include all the UI fundamentals. It's also possible to fake it with a GUI and a library. However, there's good reason to want a language that is usable on any major platform, whether or not there's a GUI.

I doubt the premise is true. Java can do all that, except maybe "window management" since I do not know what is meant by this.
I'd be surprised if you can't do it with c#.
If there are many languages that can't do this, I'd guess it is because it is difficult to do it without tying the language to the operating system.

First of all, I think you're asking why the programming languages' standard libraries don't have built-in interfaces to the window manager. The language itself and its libraries are quite distinct.
One big reason is portability. If there's too many specific functions in a programming language's libraries, it will be harder to port it to other systems. For example, I/O, math functions, strings, various data structures and related algorithms, are all generic and can be made to work on virtually any computer.
But things like the window manager, GUI, etc., they are much more specific to certain platforms which is why they are not included in the standard libraries. This is what makes C/C++ so portable.

Tasks performed by computers without any human interface device interaction outnumber those directly actuated by a human by an enormous factor.

Programming languages tries (or at least is currently trying) to be independent with the platform. Example in .net, you have to reference some Win32 api to do some of the stuffs you specified above. Getting it built-in the core programming language model, .net will become too coupled with the OS, thus, creating its Mono counterpart will be too tedious.
Regarding keystrokes, macros and some stuffs, the simplest way I'm doing it right now is true vbscript or in powershell :)

Related

Modern language IDE similar to QBasic?

I'm trying to find a modern environment similar to what I found great about QBasic but making up for the flaws. The purpose of this is to code with my 6 year old son.
I'm looking for an IDE that uses a modern language, has the ability to draw graphics and play audio, and doesn't force the User to jump around much between coding and running their application.
In QBasic you had basically two modes: Edit and Run. There were no third party libraries required for creating graphics or generating Audio tones (that I remember). You never had more than one "window" opened at a time.
Is there a modern day equivalent IDE which uses a modern language that provides what I'm looking for?
I don't want him to have to jump around between various windows, try to wrap his mind around window toolkits, understand the command line, or use OOP just to get started. My end goal is to create simple graphical games with him -- not printing text out to the console.
(Preferably cross platform or useable on Mac OSX since that's what we have at the house. Preferably Python based since that's my language of choice.)
QBasic is a great option. You can purchase an old PC from a thrift store and run QBasic on it. There is the option of QB64 which can run on both Mac and Windows. Hope this is helpful.
I'd suggest QB64, almost 100% compatible with QBasic/QuickBasic but runs on Windows.
You could maybe try Small Basic, it aimed to recreate the ease-of-use and educational purposes of the old BASIC languages build into home computers from the 1980s
The Small Basic project was initiated following this article on Salon:
Why Johnny can’t code (David Brin, 2006)

How to develop many-language / multi-platform lib?

Background: I want to develop a component therefore building a class library.
This component should be usable with many higher-order languages such as C, C#, C++, VB, Java, Haskell, Ruby, Erlang, ...
I do not want to exclude any users which are not using my development language.
Are there principles or tools which supports my project?
I searched a little bit and found Haxle for compiling into different languages, but it supports very few of them.
I would even develop parallel in all n languages to be supported, but if I want to change or fix something I have to maintain all other n-1 and the code is possibly distributed...
This is not what I know about clean code design and maintainability. So how to manage edits on code for the different languages?
What is the proper way to solve this? I am surely not the first one which want to build a library for multiple languages.
I want to develop this library (in this case for complexity reduction) in one target language but this time for multiple platforms (Unix, Win, Mac ...).
How to manage this? In fact there will be appreciated about 90% of code which is platform independent and 10% which differs for every OS.
What is the best way to control the changes in the platform dependent code? (The independent is easy ...)
What if I change so things in the part which uses Unix dependent code, then I have to trail all other platform and the code is possibly distributed.
I think #IFDEF is no option ...
Are there any experiences or hints?
I would be delighted if there are existing solutions to these problems, which are quite similar.
What you want is only possible if you provide interfaces for every language you want to support. Some kind of wrapper which transforms between the client language and ypu library.
This is possible but not practical in most cases for standalone libraries.
Take a look at webservices or or message orientad middleware. In this case your application will be provided within a special container which itself provides interface mechanism e.g.
SOAP, XML-RPC to call your application.
For 1), I would use an interface that all these languages can use. A common approach is something based on networking/TCP, like protobuffer, REST, SOAP. Many languages support these in their standard libraries, and interfaces designed with that are normally language agnostic.
There are basically two options - you could develop a network server or you could develop a JVM-based library which could be shared between some of the JVM languages like JRuby or Jython.
Update from #millimoose: you could also develop your library in C and create bindings for all other languages.
For multi-language:
I thought about TCP/middleware/webservices/REST/ which seems to be the recommended proceeding.
But I think it's all to much at runtime for only using a library.
Also the functionality is a little bit time-critical and so direct procedure calls are more fitting (instead of networking even on localhost). And the library user hasn't to construct an access component only to use the library functions.
So I think the way to go seems to be developing the library in a core language which is widely supported (C/C++, ...) and provide wrapper interfaces for the different target languages.
For multi-platform (mono-language):
No real answer has been provided also not in my mind.
Of course I could simply use Java (what I am familiar with) but what about other languages?
I am surely not the first one having this/these problem(s) ...

alternative IDE for squeak/pharo

I've been using smalltalk for a while now and I love the language and the concept. What I just hate is the System browser. This tool doesn't even resemble a modern IDE. How am I supposed to code without tabs, outlines and handy shortcuts? I often find myself implementing a selector and noticing that it would be nice to isolate a piece of code in a separate (private) selector, just for readability shake, but I don't. Because it takes like 5 mouse clicks and I have to navigate away from the selector I am working at, and navigate back to it. Oh wait, I can't! Because it has syntax errors, because I haven't finished it yet! Kills me. And I don't have a 24 inch display to open 3 browsers.
Sorry for a little rant. My question is, is there a real IDE (Eclipse, Net.Beans, VS) for smalltalk? Maybe for some commercial version of smalltalk?
You might want to check out tODE. It's at a very early stage, but it is an attempt to provide a Smalltalk IDE in the web-browser and is a break from the traditional Smalltalk IDE. With that said, I don't think you'd want to start using tODE right away, but you can keep an eye on it as it evolves.
Dale
Pharo is trying to have the Nautilus Browser ready for Pharo
1.4. I suspect there will be a flood of awesome new tools as the system stabilizes over the next few releases.
There's the Glamorous Inspector.
Spoon has been mounted as a WebDAV filesystem, so you can use whatever tool you like. Spoon is not another Smalltalk, but a testbed for revolutionary Smalltalk technology, which can be incorporated into any other Smalltalk (it's currently on top of Squeak)
There is the Tiling Window Manager to help you organize
Since Squeak and Pharo are live, dynamic, open systems powered only by volunteers, anyone sufficiently motivated can create the next generation of tools ;-)
p.s. I feel your pain. The 20-browsers-open thing is a drag. Let's invent the future!
Historically, the real "IDE" is the Smalltalk one, and one could claim that the others are just an adaptation to the limits of traditional textual programming languages (not rethorical, just check out the evolution of typical development environment UIs and how they are adding features that exists in Smalltalk from the very beggining, like the senders and references in VS).
Just a side note: actually more than 2000 open-source projects in the SqueakSource repository were coded without tabs, outlines and shortcuts (I think still in Squeak you can cross reference any text selecting and pressing with Alt-6). I can't tell you how sad I feel when I must to go back to file based developement, still don't understand why most developers love to sweep text, mess with line numbers and page up-down files in directories. The good news for you, is that you have many options:
There is an alternative browser called BobsBrowser (works in Pharo 1.3) which lets you browse
Class hierarchy windows exploring each class
System Category window
Unsaved edits
Recent classes
Recent methods
Method categories for instances and classes
Unsent methods
Driller relating every structural information
etc.
The advantage over the Whisker browser is that the hierarchical lists are attached to a window while in BobsBrowser you can detach them.
It all depends of the different activities you're performing when you're developing. With some experience in Smalltalk you'll find that you prefer some browser for exploratory insights and others for refactorings, etc. BobsBrowser for example is good for knowledge organization or custom navigation of Smalltalk classes and categories, the hierarchies you can see are the organizations from the Smalltalk reflective meta-architecture at any level (classes, senders, implementors), and they are expandable/collapsable (in the classic system browsers you can only expand the system categories and subcategories).
The instance variables were shown historically in the Smalltalk/V flavors, and there is an old goodie (from Squeak 2.7 IIRC) to enable it back again but almost nobody today maintains the classic System Browser in Squeak/Pharo. Adding that feature to OmniBrowser would be more complicated though because is a browser framework (as every serious framework, it took some time to learn it for the first time), although the effort of the Squeak/Pharo community is absolutely incredible, still the Smalltalk community needs more developers.
You have also a commercial Smalltalk which isn't public (downloadable) yet but includes IDE-like features of traditional programming environments
And I don't have a 24 inch display to open 3 browsers.
You could give the Whisker Browser a try. It lays out the methods side-by-side so that you don't have to position all these windows manually.
I played with it a few years ago but I'm not sure what state it's in right now.
I don't know how mature it is, but the Etoile project has an IDE called CodeMonkey for writing Smalltalk applications. It's not specifically for Squeak, and instead uses their own smalltalk implementation, but it may be worth looking into. Unfortunately, it's only available in their SVN repository, so it's a pain to compile and install.

Has Lua a future as a general-purpose scripting language?

As already discussed in "Lua as a general-purpose scripting language?" Lua currently probably isn't the best scripting language for the desktop environment.
But what do you think about the future? Will Lua get so popular that there will soon be enough libraries to be able to use it like Python, Ruby or something similar?
Or will it simply stay in it's WoW niche and that's it?
I think it has a great future, a lot of projects are starting to adopt it for it's simplicity and usefulness.
Example: Awesome WM (Window Manager)
The project recently released version 3, incorporating a new configuration system completely written in Lua. Allowing you to literally write your configuration file as a program, loops, booleans, data structures.
Personally I love the syntax and the flexibility of such a system, I think it has great potential.
I wouldn't be surprised if it became more popular in the future.
Brian G
I suppose the answer starts with 'It depends how you want to use it...'.
If you're writing the common business app (fetch the data from the database, display the data in a web page or window, save the data to the database), Lua already has what you need.
The Kepler Project contains goodies for web development. Check out their modules to see some of the available libraries - there's network, MVC, DBMS access, XML, zip, WSAPI, docs...
As an example web app, check out Sputnik.
For desktop UI, there's wxLua - Lua hooks for wxWidgets.
ORM is conspicuously missing but that didn't stop people from developing in other languages before ORM was available.
If you're looking for specialized libraries - scientific, multimedia , security - don't count Lua out before you check LuaForge.
When it comes down to it, there's nothing in Lua's design that prevents general purpose use. It just happens to be small, fast, and easy to embed... so people do.
Uh? I would say instead WoW is a niche in the Lua ecosystem... The world of Lua doesn't revolve around WoW, there are lot of applications, some big like Adobe Lightroom (to take a non game), using Lua.
Lua is initially a scripting language, in the initial sense, ie. made to be embedded in an application to script it. But it is also designed as an extensible language, so we will see progressively more and more bindings of various libraries for various purposes.
But you will never get an official big distribution with batteries included, like Python or Perl, because it is just not the philosophy of the authors.
Which doesn't prevent other people to make distributions including lot of features out of the box (for Windows, particularly, where it is difficult to build the softwares).
Lot of people already use it for general system-level scripting, desktop applications, and such anyway.
There are more and more libraries for Lua.
If you are a Windows user, have look at Lua for Windows. It comes with "batteries included" (wxLua, LuaCURL, LuaUnit, getopt, LuaXML, LPeg...).
Very usefull!
It's 2017, 9 years after this question was first asked, and lua is now being heavily used in the field of machine learning due to the Torch library.
I really like it as an embedded language. It's small, very easy to use and embed and mostly does what I need right out of the box. It's also similar enough to most languages that it has never really been an issue for me. I also like how easy it is to redefine and add base functions and keywords to the language to suit whatever needs my application has.
I have used it in the WoW area but I've also found it useful as a generic scripting language for a number of different applications I've worked on, including as a type of database trigger. I like Ruby and Python and other more full-featured scripting languages but they're not nearly as convenient for embedding in small applications to give users more options for customizing their environments.
being comfortable as a shell language has nothing to do with being a great general purpose language.
i, for one, don't use it embedded in other applications; i write my applications in Lua, and anything 'extra' is a special-purpose library, either in Lua or in C.
Also, being 'popular' isn't so important. in the Lua-users list periodically someone appears that says "Lua won't be popular unless it does X!", and the usual answer is either: "great!, write it!", or "already discussed and rejected".
I think the great feature of Lua is, that it is very easily extensible. It is very easy to add the Lua interpreter to a program of your own (e.g. one written in C, C++ or Obj-C) and with just a few lines of code, you can give Lua access to any system resource you can think of. E.g. Lua offers no function to do xxx. Write one and make it available to Lua. But it's also possible the other way round. Write your own Lua extension in a language of your choice (one that is compilable), compile it into a native library, load the library within Lua and you can use the function.
That said, Lua might not be the best choice as a standalone crossplatform language. But Lua is a great language to add scripting support to your application in a crossplatform manner (if your app is crossplatform, the better!). I think Lua will have a future and I think you can expect that this language will constantly gain popularity in the long run.
Warhammer Online, and World of Warcraft use it for their addon language I believe.
I think it's hot! I'm just no good at it!
Well, greetings from 2022.
It is already a general purpose language. Today you can even serve pages using OpenResty, extend games, read databases or create scripts as shellscript replacements.
There are a plenty of libraries "modules" for Lua, many ways to achieve what you are wanting and Lua 5.4 is even faster.
The "extendable and extensive" nature of Lua, accostumed people to think it should only be used as plugin or extension. In Linux, by example, you can shebang a file with lua-any, make it executable and run like any system script. Or you can make a folder app like Python or virtualenv using Lupe. Lua 5.3 also gained impressive performance improvements.
Also there are many good tools like IUP to create native windows in Lua for Mac, BSD, Linux and Windows and side environments like Terra that lets you use Lua with its counterpart Terra and write compiled programs. Lua now, is more than a extension language, it has its own universe.

What's the best automation or scripting tool to automate repetitive tasks with applications?

I realize you can script Microsoft Office apps, but I'm looking for something more general that I can apply to other apps, such as Adobe Acrobat, web browsers and other apps with no scripting ability.
I've used AutoIt but it's a bit clunky, especially when trying to debug why a script fails or stalls. Also, getting the timing of actions, such as clicking a button, or selecting a menu item correctly can be a pain.
Are there build tools that could be used for this purpose?
I recommend AutoHotKey. Its syntax is not pretty, but most of the times you don't have to concoct your own scripts, because its community is so large and well organized. Even if you do, the documentation is extensive and good and the forums will answer your questions quickly. The developer is active and responsive, which means that bugs get fixed quickly, and new features are being considered and added.
Since I began using AHK I don't imagine doing without it - it allows to make life on Windows simpler in so many ways.
You can also employ the COM interface from Python and other scripting languages. It is more complex, but you get to use a more powerful language.
I love AutoHotkey (small k...) too, but beside its odd syntax, it has the same lack of debugging tools...
Basically, that's "show msgbox alerts, send strings to file or debugview, trace". Which is OK for most cases, since you rarely write long and complex applications with these tools.
In both tools, and probably all macro softwares, "timing of actions" will be hard to get anyway, because events are asynchronous: most of the time, you don't wait a given time, but you wait for a window to appear. Hoping it is the right one!
There are other automation tools, like Ranorex (I didn't tested it), you can even use some scripting language (Lua, Python) with a library to send messages (WM_XXX) and another to call WinAPI... But tools like AutoIt and AutoHotkey have the advantage of having been extensively tested, so they can handle a large number of behaviors/issues (like waiting for clipboard data to be available, etc.).
Might be a bit much for your needs but AutoMate is very robust and easy to use. Doesn't require any scripting skills as most tasks can be constructed via drag and drop http://www.networkautomation.com/sales/scripting/