Jump to content

What's the difference between objects and expresions?


BeuysVonTelekraft

Recommended Posts

"Notice that Lisp is an object-oriented language in the sense that it evaluates objects, not expressions." Common Lisp (Shapiro)

 

On searching for definitions of both elements of the dicotomy:

 

OBJECT:

 

In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. (With the later introduction of object-oriented programming the same word, "object", refers to a particular instance of a class)(Wikipedia)

 

EXPRESSIONS:

 

An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces (returns, in a stateful environment) another value. This process, like for mathematical expressions, is called evaluation. The value can be of various types, such as numerical, string, and logical. (Wikipedia)

 

Both share some elements, a value or a variable can be both an object or an expression. So, what's the difference?

 

 

 

 

 

Link to comment
Share on other sites

"Notice that Lisp is an object-oriented language in the sense that it evaluates objects, not expressions." Common Lisp (Shapiro)

 

On searching for definitions of both elements of the dicotomy:

 

OBJECT:

 

In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. (With the later introduction of object-oriented programming the same word, "object", refers to a particular instance of a class)(Wikipedia)

 

EXPRESSIONS:

 

An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces (returns, in a stateful environment) another value. This process, like for mathematical expressions, is called evaluation. The value can be of various types, such as numerical, string, and logical. (Wikipedia)

 

Both share some elements, a value or a variable can be both an object or an expression. So, what's the difference?

 

I suggest you don't go too much into theory, because only it's very complex to understand (computer science roots are mathematical logic)

Other scientists other than mathematical logic scientists, would find it very hard to understand theories like Incompleteness, and Chaos .. for example

 

Anyway, I suggest you try to use the formal definitions, technical terms .. so let me show you this,

 

Programming Language Types:

 

1. Expression Languages: (aka Script Languages) the language is interpreted as given, line by line .. evaluation is its key, example: DOS, Bash, HTML, ..etc

 

2. Statement Languages: the language is written as set of ordered statements (like algorithm) compiled in a code, example: C, Python, JavaScript ..etc

 

3. Functional Language: (aka Lambda Calculus) it's more like a programming language where you code your language, example: Prolog, Lisp, ..etc

 

4. Object-Oriented Languages: where code is structured into objects created from classes (blue-prints), example: Java, C++, C#, ..etc

 

 

Note: Expression, Statement, & Functional Languages have linear flow, but Object-Oriented Languages have universal flow, example: Linear flow

is like saying in my universe at a given time, there exist only 1 living creature that progress, but universal flow is like saying at a given

time all existing creatures are alive and progressing !

 

good luck,

Edited by khaled
Link to comment
Share on other sites

I didn't get this. Isn't it possible to make algorithms on all these languanges?

 

Yes you can, but you see Statement-based languages are based on ordered set of statements, it looks like an algorithm

example: C

int min_algorithm ( int a, int b )
{
     if ( a == b ) return (a); // 1. if equal, return any

     if ( a < b ) return (a); // 2. if a is less than b, return a

     return (b); // 3. otherwise, return b
}

 

Functional Programming on the other hand, you have two-steps behind, you have to use Lambda Rules to form your own Formal Language,

which you will use to write the code of your program, usually used for logic ...

 

In Object-Oriented languages, you have an easier way to code Parallel Algorithms, which are non-linear ...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.