A case for Ruby and Unix

General technological topics without their own forum go here

A case for Ruby and Unix

Post by KthProg on Sun Feb 03, 2013 4:00 pm
([msg=73337]see A case for Ruby and Unix[/msg])

I honestly would have not even considered using Ruby, and especially not the underdeveloped OS's that are collectively called *nix, until I got to page 60 in 'The Book of Ruby'.

I now think there are two points I can make:

1.If you're going to script, use Ruby
2.If you're going to use Ruby, use a *nix system

There are so many reasons you should use Ruby; embedding arrays in arrays, the ability to treat strings as arrays of characters, the ease of access to file I/O, embedding functions in arrays, creating get/let statements in one line, heredocs for creating large strings, and my personal favorite -- ranges of strings.

When you use a range in Ruby like this
Code: Select all
For str in ("aaaaaaaa".."ZZZZZZZZZZZZZZZZ") do
tab--> puts(str)
End

It will iterate though all letter combinations from 8 lowercase a's to 16 uppercase Z's.
Now this might not be practical or useful in most situations, but it's certainly better than the alternative in other languages.

My second point is about Ruby and *nix and the way they could work together.
In Ruby, surrounding a string with backwards apostrophes like this
Code: Select all
myDirs = `dir`

will send the command dir to your PC [in windows this will return a list of folders and files] and set the variable 'myDirs' equal to the return value.
This is an EXTREMELY unique and very useful feature of Ruby.
Mix this with the variety of commands on a *nix system, and you have a scripting language OS combination that can do just about anything.

Correct me if I made any mistakes lol.
User avatar
KthProg
Poster
Poster
 
Posts: 219
Joined: Wed Jan 23, 2013 7:06 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by 0phidian on Sun Feb 03, 2013 8:43 pm
([msg=73353]see Re: A case for Ruby and Unix[/msg])

Pretty sure you can do all of that in any high level language, the syntax is just different. The way you do it in Ruby does look interesting though. I have considered learning ruby sometime, but even if I do I have sworn an undying allegiance to Python. So,

1. If your going to script, use Python.
2. If you have a computer, run Linux.
(I'm not baised at all) :mrgreen:
User avatar
0phidian
Poster
Poster
 
Posts: 257
Joined: Sat Jun 16, 2012 7:04 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by KthProg on Sun Feb 03, 2013 8:53 pm
([msg=73355]see Re: A case for Ruby and Unix[/msg])

Honestly ive been using VB.net forever and python is vb.net without the end statements and with less features.
and yes the syntax for doing these things is usually very complicated or at least slightly more complicated in other languages.
also in ruby, every type of statement has a version of it which can be used inline such as
Code: Select all
runMethod while myBoolean end


this is clearly more intuitive and obviously easier then

Code: Select all
while myBoolean = true
runMethod
end


honestly, python may have some merits, but not nearly as many as Ruby.
I tried reading the python manual and I was just plain not impressed whereas Ruby impresses me every page.

I mean if Ruby has convinced me, a serious windows user and .NET programmer, to put a *nix OS on one of my PCs, obviously there's something special about it.

also Ruby is extremely object oriented
everything in ruby is a class or method and therefore everything can be overloaded, subclassed and so on.

even operators like -,+,* etc are methods of some Ruby class.
now you can choose how addition works, how to compare arrays, everything really.
and you can create and do math with matrices
(both of these are very important working in non-Euclidean space)

it also handles things like thisarray - anotherarray without an error,
it will simply return thisarray with all matching elements from anotherarray removed.
Last edited by KthProg on Sun Feb 03, 2013 9:02 pm, edited 2 times in total.
User avatar
KthProg
Poster
Poster
 
Posts: 219
Joined: Wed Jan 23, 2013 7:06 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by -Ninjex- on Sun Feb 03, 2013 8:58 pm
([msg=73356]see Re: A case for Ruby and Unix[/msg])

I'm looking forward to learning Ruby soon. I love python as well. While learning c++, I find it to seem more like home to me, next to JavaScript.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1204
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by KthProg on Sun Feb 03, 2013 9:01 pm
([msg=73357]see Re: A case for Ruby and Unix[/msg])

I honestly have so much disdain for JavaScript and VBScript (different than VBDotNet), both are messy and need to be reworked to keep up with python and Ruby IMO.
User avatar
KthProg
Poster
Poster
 
Posts: 219
Joined: Wed Jan 23, 2013 7:06 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by -Ninjex- on Sun Feb 03, 2013 9:05 pm
([msg=73358]see Re: A case for Ruby and Unix[/msg])

I agree with the fact that Python is more advanced, however I think JavaScript does a good job at what it was designed to do. As for VBS, I have no understanding.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1204
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by KthProg on Sun Feb 03, 2013 9:07 pm
([msg=73359]see Re: A case for Ruby and Unix[/msg])

Python is more advanced and has better syntax than JavaScript.
But Ruby still beats both.

VBScript is mostly used to automate applications, VBA is used to extend applications, VBDotNet is used to develop applications.

no one uses vbscript anymore because the syntax is terrible
so
freaking
terrible
User avatar
KthProg
Poster
Poster
 
Posts: 219
Joined: Wed Jan 23, 2013 7:06 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by fashizzlepop on Sun Feb 03, 2013 9:11 pm
([msg=73360]see Re: A case for Ruby and Unix[/msg])

This thread is filled with so much WTF for me.

Mostly that Linux is NOT "underdeveloped" and secondly that Python has as many features if not more than VB.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by KthProg on Sun Feb 03, 2013 9:13 pm
([msg=73361]see Re: A case for Ruby and Unix[/msg])

maybe VBScript not more than VBDotNet

Pythons main claim to fame is that it has a list which is a dynamically sized array that can contain different types of values.
this is called an ArrayList in VBDotNet and is built into arrays in Ruby.

other than that it claims more productivity due to the tab-delimited statements.

with rubys inline statements, I would say it is equal to python in efficiency.
in fact, with heredocs for large strings and the ability to use one statement to create a simple property let/get, it's more efficient, and with the ability to overload built in functions and subclass any object, Ruby is much more customizable.
User avatar
KthProg
Poster
Poster
 
Posts: 219
Joined: Wed Jan 23, 2013 7:06 pm
Blog: View Blog (0)


Re: A case for Ruby and Unix

Post by fashizzlepop on Sun Feb 03, 2013 9:24 pm
([msg=73363]see Re: A case for Ruby and Unix[/msg])

Python has as much capability as VB.net.

I can almost guarantee python has more libraries than Ruby as well.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Next

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests