Friday, June 8, 2012

USL 3.8.6

I'm back for a bit. I decided to add a few things that people had mentioned in the past, like an alternative for the counter-intuitive orif keyword and the lack of the ability to iterate an enumeration of object members. I decided to go ahead and add elif and elsif in respect to Python, Perl, and Ruby. I also made the --parse parameter known. Unless you disassembled USL, you probably would not have known about the ability to parse commands without starting the shell or running a script. To be honest, I have no clue as to why I didn't list that parameter in the help menu. And for Bruce, the only non-anonymous person to ever post a comment on my blog, I have created a way to iterate an enumeration of object members. I also changed the numeric datatype of numeric variables in order to deal with larger numbers. That about sums everything up. Here are some code samples.

Iterating an Enumeration of Object Members:

# Print all USL environment variables
for v in env.get_members
       say ${v}
endfor

# An object for demonstration
object o
       @hello = "Hello"
       @world = "World"

       method a
              say "In a()"
       end

       method b
              say "In b()"
       end

       method c
              say "In c()"
       end
end

# Print each value of all variables in an object
for v in o.get_variables
       say o.${v}
endfor

# Execute all methods in an object
for m in o.get_methods
       ! "o.${m}"
endfor
If you want an enumeration outside of a loop, you can create a list and add to the list as you iterate.

The elif and elsif keywords:

if 0 == 1
       say "This is false..."
elsif 1 == 0
       say "This is a Perl-esque 'else if' statement."
elif 1 == 1
       say "This is a Python-esque 'else if' statement."
endif
Other than these examples, there's not much else to show you. Here is how you use the --parse parameter:
./usl -p "for i in (10..1);out '${i}...';delay 1;endfor;say 'blastoff!'"
It's a cheesy example of a countdown, but it's pretty neat. The parse parameter is for when you don't feel like running the interactive shell or writing a script. I guess it could have other uses, but that's for you to decide.

Thanks for reading.

To download 3.8.6, you can visit any of the following links:
sourceforge
freecode
github

Monday, April 9, 2012

USL 3.8.5

I have added two keywords to USL: "lock" and "unlock".

Normally, all objects are removed when "clear_all!" is called. I have made it possible to save methods and variables from this destructive command.

There are two ways to create an "indestructible" method, but only one way to create an "indestructible" variable.

Here is an example of a method:
[method] indestructible_method
       say "I am indestructible."
end

method another_method
       say "I will be indestructible."
end

lock another_method

say "both methods are indestructible."

clear_all!

indestructible_method
another_method

unlock indestructible_method
unlock another_method

say "both methods are now destructible."

clear_all!

The same "lock" and "unlock" command may be used on variables, just as we did with methods.

To download 3.8.5, you can visit any of the following links:
sourceforge
freecode

Friday, January 13, 2012

IN HIATUS

I begin college in the next few days.

I have been relearning a lot of stuff from my high school years to give me hopefully what will be an upper-hand.

I've been making music to keep the stress to a minimum.

When I become attuned to my schedule, I will find time to develop USL. I still have a lot of ideas and need to work out a few kinks.

Namely nests and a few other features.

This project isn't dead, and neither am I. Just in hiatus.