26288 total geeks with 3498 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
MaxMouse
It's Friday... That's good enough for me!
CodeX
non stop lolz here but thats soon to end thanks to uni, surely the rest of the world is going good?
stabat
how things are going guys? Here... boring...
CodeX
I must be going wrong on the password lengths then, as long as it was done on ECB
MaxMouse
lol... the key is in hex (MD5: of the string "doit" without the "'s) and is in lower case. Maybe i should have submitted this as a challenge!

Donate
Donate and help us fund new challenges
Donate!
Due Date: May 31
May Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
Experts: Network
security
deteriorating,
privacy a lost
cause
Internet cafés
declared "illegal
businesses" in Ohio
SAP shuffles execs
to chase cloud
success
AT&T adds 61˘
"Mobility
Administrative Fee"
for users
Microsoft caves to
Google, pulls
YouTube app from
WinPhone Store
Amazon expands
Appstore reach,
gives devs more
user data
Now it gets
serious: Fracking
could RUIN BEER
Reports: New Xbox
could DOOM
second-hand games
market
Industry execs:
Network admins are
an endangered
species
Wikileaks leaks
documentary script
about Wikileaks
Slashdot
African Soil Mapped
For the Very First
Time
BeagleBone Black
Ships With New
Linux 3.8 Kernel
Google Releases
Glass Factory
System Image,
Rooted Bootloader
White House: Use
Metric If You Want,
We Don"t Care
A Snapshot of the
Inside of an Atom
WHO: Intellectual
Property Claims
Hindering Research
On Deadly Novel
Coronavirus
Google Plans
Wireless Networks
In Emerging Markets
Intel Claims
Haswell
Architecture Offers
50% Longer Battery
Life vs. Ivy Bridge
Facebook Cancels UK
Launch of HTC First
Judge Thinks Apple
Will Lose E-Book
Price-Fixing Case
Article viewer

The power of interpreted languages



Written by:dimport
Published by:dimport
Published on:2003-06-21 07:19:46
Topic:Miscellaneous
Search OSI about Miscellaneous.More articles by dimport.
 viewed 6399 times send this article printer friendly

Digg this!
    Rate this article :
One thing I've noticed in working with interpreted languages over compiled languages, is the ability to re-evaluate itself, i.e. self modification. Using this, the possibilities are endless, although it often leads to obfuscation. This article is just some observations.

One thing I have yet to see is compiled code that can modify itself safely. Try to poke at your own program memory and the OS will probably go down or segfault or something (not poke in the sense of push memory, but just mess around in general). As an example, here's the start of a calculator I wrote in TCL:
 
proc num {newval} {
    global curnum;
    global clr;
    if "$clr == 1" then {set curnum 0; set clear 0}
    set curnum [expr ($curnum*10)+$newval];
}

for {set x 1} {$x<10} {incr x} {
    set txt$x $x;

    set no$x [button .b$x -text "$x" -command "num $x"];

}
In a compiled language, this would require a load of 10 button statements (although this is actually 11 lines... I had a way to remove the procedure, but I forgot it and now I'm stuck with this). However, on a larger scale, this could be used to generate something like the insane table in Lamebulun 1, with just a few lines of code. I chose TCL for this, as it's block formatting and positional syntax make it ideal for a mess like this.Another useful trick with interpreted code is perl one-liners and similar. Taken from the linux gazette:
perl -wlne'BEGIN{$b=rand$=}$a=qw/Up exit Down/[($_<=>int$b)+1];print eval$a'
A compiled language like C would require you to have some overhead, i.e. stdio.h, explicitly defining vars with types, etc. When you start playing with perl, ruby or similar languages, and understand them enough to code like that, trivial tasks become much easier. Unfortunately, I'm not really at that level yet with any language, so trivial tasks have to be performed manually.My final point about scripts/interpreted languages, is that they are almost forced to embrace open source principles. If you write a script, people are going to read it. It can't be helped. I somehow don't see someone selling a script with a standard license, saying you can't reverse-engineer it. Whilst a license may not permit you to modify and re-release code, you can still learn from it, which is almost as good.

This article was originally written by rekless

Did you like this article? There are hundreds more.

Comments:
<none>
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
Action
First one on Tue 12th Jan 10pm
Yaw, this is the first blog post, just to begin with something. Nice site here, cool features like OSIDrive, and so on. However, strange that an "OpenSource Institute" uses non-OpenSource softare to host its site (Windows and IIS). It's not correct... I t
bb
A Daily Profanity at dailyprofanity.com on Mon 21st Dec 11am
For anyone who likes viz, and roger mellies profanisaurus. There's a website called amusing daily profanity which dishes up a humorous profanity every day via rss, twitter email and a few other ways. Rather rude words, but very funny in my opinion,
hambone
Blog entry for Wed 25th Nov 7pm on Wed 25th Nov 7pm
wtf i can't do geek 12. I don't know what to do. i want to kill myself becuz of this
haziman
Blog entry for Mon 9th Nov 4am on Mon 9th Nov 4am
for all geekos out there...
echmil
fuck you all!!!!!!!! on Sat 7th Nov 11pm
jag har tjock med tyngate tråkigt-.-
goldie
Blog entry for Tue 5th May 6am on Tue 5th May 6am
import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; import java.io.*; import java.util.Properties; public class SENDMAIL { public void sendMail(String mailServer, String from, String to,
bb
Bubble Graph on Wed 11th Mar 12pm
I love this graph bubble graph http://www.osix.net:80/modules/folder/in dex.php?tid=28125&action=vf
ketan404
My online resume! on Mon 9th Mar 8am
It is here http://www.listoffreelancers.com/profile s/ketankulkarni Simple and clean design. I like this website. Ketan
macrocat
Blog entry for Sun 8th Mar 3pm on Sun 8th Mar 3pm
Another site with some challenges. Basically, I'm linking this to get a measly five points ;O. Hellbound Hackers
Nightscript
Parapsychology - Fri 19th Dec 5am on Fri 19th Dec 5am
Yes i'm crazy but heres what ive been thinking about and it seems more reasonable that a lot of reality. Note that this ties into parapsychology/psychokinesis research. Mind is not over matter. Thats the wrong state of thinking for sure. Look, this


     
Your Ad Here
 
Copyright Open Source Institute, 2006