Quote:
I.e. under Windows you'll need a .bat script that would bootstrap everything as needed. |
FWIW Windows Script Host can do Javascript/JScript out of the box as well as VBScript (plus scripting engines for perl, python, etc). And there's Windows PowerShell with a v2 for newer OSs. Also C#/.Net stuff can be crossplatform with Mono iirc.
Something written in perl/python/Java should be able to be almost write once, run anywhere. At least just between Windows and linux on x86 machines. As a syntax I say that python example with common words is far easier to read than the perl use of characters. Understanding of either does completely depend on knowledge of the language. Breaking things between language version 2 and 3 doesn't mean they don't pay a lot of attention to regression testing. I've never quite got the hard-on some people have for closures/anonymous functions/lambdas in imperative languages. Nor do I see a problem with return statements. Seems there's been decades and many successful languages that have things the way you don't prefer, so can we all be so wrong? :) Yes CPAN is well known as a valuable resource that any language would be blessed to have. Apparently there's no written spec or standard for perl prior to 6, which isn't ready yet. ;) As for ~250MB data structures in python, I'd say it's possibly not really the best tool for that job, and that there's the C API/bindings of the mainstream implementation CPython. Also, EVE Online's python/stackless python. I don't think anyone's going to disagree that no language is perfect, some aim for more practical features, others to stick to more abstract or theoretical ideals of computation expression. Always good to check you're up to date on the state of different tools, sorry for any derailment OP. Let us know if/when you get those firm answers about language options and user interaction and if you still need help. Edit: Sergei, is there really an issue about a feature being in the language itself vs the standard library? And the OP may very well care what IT say even if they can be technically sidestepped, for support and legal reasons. |
Quote:
Closures is a fundamental expression of stateful (opposed to stateless) code. All those fancy OO data class members are just variables at outer scopes of closures. I came to all this not at school, but through practice - luckily, met a couple of younger guys who suggested to try, and after trying I realized I really liked them - they made life easier. Also, not only my life. When, say, 20 people on project need to write configuration files, and I work as an integrator, my own interest is to make sure that by construction there are no contentions. |
Quote:
Code:
mylist = ["foo", "bar"] Quote:
|
Quote:
Quote:
Bear in mind too that if money is involved then the IT folks become a party in the solution because such software needs evaluation and approval. Popular scripting languages are free/libre software and potentially avoid much of that red tape. With that said, generally I prefer the principle of "seeking forgiveness rather than asking permission." :) One method to bypass locked systems is a USB flash drive. I have suggested that option if the IT people refuse to let us install Cygwin --- we can run the scripts from a USB stick. Another option is to install to a shared network directory that belongs to the group. Generally IT people let users in such groups do as they please inside those directories. I have suggested that option too. Another option is to run the Cygwin environment and scripts from user's home directories, although that consumes more network drive space than a common installation. All of these work-arounds require scripts to know path locations for any such unique installation. As long as any such work-around does not introduce viruses, spyware, or anything else that raises the ire of the IT people, then likely there are no repercussions and everybody lives happily ever after. :) Quote:
Yet even then, my script uses external tools such as awk and sed. I would have to simulate those external calls as internal functions or find a way to run the GNUWin32 equivalent of those tools from within any script. So once again I'm back to installing software unless I can perform everything internally in the ported script. If installing software is approved, then I'll just stick with the Cygwin software. With respect to this thread, I basically wanted to know how much is involved to port a shell script to a different scripting language on a different operating system. Doable, but lots of work. :) With respect to my other thread, I have a solution in place (Cygwin), but now wait for approval. |
Quote:
|
Quote:
|
Yes I thought we'd covered that almost everything you're using common utilities for can be expressed within each programming language. And probably not much work, generally you just have a little more declaration of variables and flow control, a little more verbosity about which features/functions you're using.
I'm not getting why something in e.g. Java would care how one has named one's methods and variables within a useful library any more than they would if it were in perl. Pass the arguments as however you've named them, be oblivious to how the method's implemented, assign the result as you wish. The only thing seems to be the name of the method, and that's down to having a sane creator of the library you're using. As for naming contention, namespaces. If you really want to rename the method, subclass, wrapper method with the name you want just passing the arguments to the other method, done? In a similar vein, Java seems fine with interfaces and anonymous classes whenever anonymous functions are needed. There must be some class of algorithm that I'm just not used to, that works best with passing function references around, rather than just object references to implementing class instances. I still can only think that Sergei's talk of arrays in python is the lack of control around consecutive memory locations, to perform in-place inserts/sorts in the most manual and efficient manner. Beyond that, afaik python gives you several sequential mutable data types that you can place empty or null values in, but just can't micromanage the memory for behind the scenes. Well, unless you subclass them iirc. I don't know anywhere that's got VB of any flavour as an Invest tech, thought I'm sure there's some. I'd strong suggest you at least look at C# if you're going with anything using the .Net framework & libraries. I have little experience of it, but Cygwin sounds a rather hefty solution to your problem, though as you say you can leave your script as is, calling those common separate utilities. |
Quote:
Code:
use List::Util 'shuffle'; Code:
my $f = require '/full/path/to/function.prl'; This is a piece of code I'm using in my tool building stuff from sources. |
What global namespace is there to pollute? Stuff in Java is always in a class, constants and methods are imported and references to them get qualified as required if there's contention.
Your 2 variables outside the function would probably be object variables instantiated for each independant use of this method that you'd need, or just static variables for the class the methods are defined in. I don't see the problem your syntax is solving, perhaps Java doesn't have it to start with, being OO the way it is and compiled to bytecode. Again, define this class as implementing whatever interface your code with the $f equiv needs, and you can pass it an object instance that has the one or more methods, with you naming the reference as you wish. Not seeing the big win here. No you can't pass completely arbitrary objects around (well without deeming them simply of type Object and later casting them back to classes/interfaces you know of), but that's stopping you mess something up, instead you define the interface aka method signatures the passed object must implement, and beyond that people are free to implement those as they wish, using whatever variable and private method naming schemes, and your caller need know or care nothing about them, while the compiler checks at compile time that you've not passed the wrong reference. If you want to get more into arbitrary method calls, Java has reflection, you can list an object's method names/signatures as text and then build a call to them dynamically afaik. Couples in with web services and other remote method invocation iirc. I'm no expert, I already said no language is perfect, but I don't see how perl's solving a problem that Java's stumped by here. And strong typing and compiler-time checks are good. |
Quote:
And if you are going to tell me there are namespaces on top of classes, I'll tell you that namespaces are global, i.e. using namespaces causes a headache of having their names unique. Languages without anonymity are defective by design. |
@Proud
This is slightly unrelated, but still relavent: One thing I don't like about many OOP languages without first class functions if that they force OOP down your throat when first-class functions would make it so much easier. For example, in an OOP language, if you wanted to make a customizable sorting function, you would have to define a class (that pollutes the global namespace) that has a comparison method, create an instance of it, and pass it to your sorting function. In a language with first-class functions, you just pass an anonymous function, like this: Code:
my_sorting_function(func (a, b) <do comparison here> endfunc, my_array) EDIT: If the language supports closures, another advantage is that the sorting function can use variables in the scope in which it was created. Try doing that in Java. |
Quote:
---------- Post added 08-22-11 at 12:45 AM ---------- Oh, and Java-7 finally has closures (IIRC). And Scala is functional - there should be a way of modernizing Java world. |
Quote:
Quote:
|
OP: apologies, I didn't mean to get your thread hijacked by a language war
|
All times are GMT -5. The time now is 07:11 PM. |