What are OOP's Jargons and Complexities?

W

Wibble

Thats how common lisp specifies a vector.

Andreas, your link indicates that lisp is a Weakly typed language not
strong. Theres no compile time type semantics, at least in CommonLisp,
MacLisp, ZetaLisp or FranzLisp.

(setq foo #(1 2 3))
(setq foo 1)
(setq foo "Whatever")


Theres no type associated with foo, only with what the variable is
currently referencing.

From your link:
When the types detected or declared are strictly enforced by the
language's semantics, the language is strongly-typed.
when the semantics of the language allows for inconsistencies between
the compile-time type and the run-time type, the language is
weakly-typed.
 
P

Paul Rubin

Wibble said:
Andreas, your link indicates that lisp is a Weakly typed language not
strong. Theres no compile time type semantics, at least in CommonLisp,
MacLisp, ZetaLisp or FranzLisp.

There are runtime semantics that enforce types.
From your link:
When the types detected or declared are strictly enforced by the
language's semantics, the language is strongly-typed.
when the semantics of the language allows for inconsistencies between
the compile-time type and the run-time type, the language is
weakly-typed.

Yes, the compile-time type of 3 is integer, and the runtime type of 3
is also integer. There is no inconsistency. Compare that with C,
which lets you cast 3 to a pointer.
 
A

alex goldman

John said:
Unfortunately, there is no
consensus as to what the term means.

If the language allows the programmer to write programs from the 'slack'
domain, by saying "just trust me on this", then it's not strongly typed.

What other meanings are there? I wasn't aware of the lack of consensus.
 
P

Pascal Costanza

alex said:
If the language allows the programmer to write programs from the 'slack'
domain, by saying "just trust me on this", then it's not strongly typed.

What other meanings are there? I wasn't aware of the lack of consensus.

There is a difference between getting a core dump when you invoke
undefined behavior on some object, or just getting an exception. You can
programmatically react to an exception to do something meaningful but
not to a core dump. Some people use the term weak typing to refer to
languages that potentially core dump whereas they use the term strong
typing for languages that don't.


Pascal
 
P

Piet van Oostrum

Tassilo v. Parseval said:
TvP> Most often, languages with strong typing can be found on the functional
TvP> front (such as ML and Haskell). These languages have a dynamic typing
TvP> system.

What do you mean with: 'Haskell has a dynamic typing system'?
 
R

Roy Smith

Xah Lee said:
Joe: lang x is strongly typed
Dave: you mean statically typed?
John: no no, that's weakly typed.
Mike: actually, it is dynamically typed!

I used to have a bunch of comp sci questions I would ask interview victims.
One of them was "what does it mean when a language is strongly typed?" I
once had somebody tell me it meant the language had long variable names,
and thus took a lot of typing.
 
P

Paul Rubin

Roy Smith said:
I used to have a bunch of comp sci questions I would ask interview victims.
One of them was "what does it mean when a language is strongly typed?" I
once had somebody tell me it meant the language had long variable names,
and thus took a lot of typing.

But that's incorrect. Strong typing means there's a lot of variables
whose names are in ALL CAPS.
 
A

alex23

Joe: So I gave my girlfriend some flowers.
Dave: What, like tulips?
John: No, no, he gave her roses.
Mike: Were they red roses?
Xah: You MORONS, they were JUST _flowers_! Enough with the mother
fucking jargon already!!

The moral of the story being that when you're not active in a specific
domain, the intricacies of it can easily look irrelevant to you.

-alex23
 
P

Piet van Oostrum

Xah Lee said:
XL> Joe: lang x is strongly typed
XL> Dave: you mean statically typed?
XL> John: no no, that's weakly typed.

That should have been `weekly typed', according to the link below.
Maybe there is also `daily typed' or `monthly typed'?
 
X

Xah Lee

The Rise of “Constructors†and “Accessorsâ€

A instantiation, is when a variable is assigned a super-subroutine
(class). A variable assigned such a super-subroutine is now called a
instance of a class or a object.

In OOP practice, certain inner-subroutines (methods) have developed
into specialized purposes. A inner-subroutine that is always called
when the super-subroutine is assigned to a variable (instantiation), is
called a constructor or initializer. These specialized
inner-subroutines are sometimes given a special status in the language.
For example in Java the language, constructors are different from
methods.

In OOP, it has developed into a practice that in general the data
inside super-subroutines are supposed to be changed only by the
super-subroutine's inner-subroutines, as opposed to by reference thru
the super-subroutine. (In OOP parlance: class's variables are supposed
to be accessed/changed only by the class's methods.) Though this
practice is not universal or absolute. Inner-subroutines that change or
return the value of variables are called accessors. For example, in
Java, a string class's method length() is a accessor.

Because constructors are usually treated as a special method at the
language level, its concept and linguistic issues is a OOP machinery
complexity, while the Accessor concept is a OOP engineering complexity.

-----
to be continued tomorrow.

This is part of an installment of the article
“What are OOP's Jargons and Complexitiesâ€
by Xah Lee, 20050128. The full text is at
http://xahlee.org/Periodic_dosage_dir/t2/oop.html

© Copyright 2005 by Xah Lee. Verbatim duplication of the complete
article for non-profit purposes is granted.

The article is published in the following newsgroups:
comp.lang.c,comp.lang.c++,comp.lang.lisp,comp.unix.programmer
comp.lang.python,comp.lang.perl.misc,comp.lang.scheme,comp.lang.java.programmer
comp.lang.functional,comp.object,comp.software-eng,comp.software.patterns

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
X

Xah Lee

the Rise of “Access Specifiers†(or, the Scoping Complexityof OOP)

In programing, a variable has a scope — meaning where the variable
can be seen. Normally, there are two basic models: dynamically scoped
and lexically scoped. Dynamic scoping is basically a time based system,
while lexical scoping is text based (like “what you see is what you
getâ€). For example, consider the following code:
subroutine f() {return y}
{y=3; print f()}

In dynamic scoping, the printed result is 3, because during evaluation
of the block all values of y is set to 3. In lexical scoping, “yâ€
is printed because any y in the block is set to 3 before f is called.
With regards to language implementation, Dynamic Scoping is the
no-brainer of the two, and is the model used in earlier languages. Most
of the time, lexical scoping is more natural and desired.

Scoping is also applicable to subroutines. That is to say, where
subroutines can be seen. A subroutine's scope is usually at the level
of source file (or a concept of a module/package/library), because
subroutines are often used in the top level of a source file, as
opposed to inside a code block like variables.

In general, the complexity of scoping is really just how deeply nested
a name appears. For example see in the following code:
name1; // top level names. Usually subroutines, or global
variables.
{
name2 // second level names. Usually variables inside subroutines.
{
name3 // deeper level names. Less often used in structured
programing.
}
}

If a programing language uses only one single file of commands in
sequence as in the early languages such as BASIC, there would be no
scoping concept. The whole program is of one single scope.

OOP has created a immense scoping complexity because its mode of
computing is calling nested subroutines (methods) inside subroutines
(classes). We detail some aspects in the following.

In OOP, variables inside subroutines (class variables) can also be
accessed thru a reference the subroutine is assigned to (that is, a
object). In OOP parlance: a variable in a class has a scope, while the
same variable when the class is instantiated (a objet) is a different
scoping issue. In other words, OOP created a new entity “variable
thru reference†that comes with its own scoping issue. For example:
class a_surface() {
coordinates={...}; // a variable
}

class main() {
mySurface = new a_surface();
mySurface.coordinates = {...}; // the same variable
}

In the above code, the variable “coordinates†appears in two
places. Once as defined inside a_surface, and once as a instantiated
version of a_surface, that is, a object. The variable as thru the
object reference apparently has a entirely different scoping issue than
the same variable inside the subroutine (class) definition. The
question for OOP language designers is: what should the scope be for
variables referred thru objects? Within the class the object is
created? within the class the variable is defined? globally? (and what
about inherited classes? (we will cover OOP inheritance later))

As we've seen, methods are just inner-subroutines, and creating objects
to call methods is OOP's paradigm. In this way, names at the
second-level programing structure often associate with variables (and
inner-subroutines), is now brought to the forefront. This is to say,
the scoping of subroutines are raised to a level of complexity as the
scoping of variables. (they are now both in the 2nd level of names (or
deeper).)

All in all, the scoping complexities of OOP as applied to different OOP
entities (classes, class variables, class's methods, object variables
and methods) is manifested as access specifiers in Java. In Java,
access specifiers are keywords “privateâ€, “protectedâ€,
“publicâ€, used to declare the scope of a entity. Together with a
default scope of no-declaration, they create 4 types of scope, and have
entirely different effects when used upon a variable, a method, a
constructor, and a class.

See this tutorial of Java's access specifiers for detail:
http://xahlee.org/java-a-day/access_specifiers.html
-----
to be continued tomorrow.

This is part of an installment of the article
“What are OOP's Jargons and Complexitiesâ€
by Xah Lee, 20050128. The full text is at
http://xahlee.org/Periodic_dosage_dir/t2/oop.html

© Copyright 2005 by Xah Lee. Verbatim duplication of the complete
article for non-profit purposes is granted.

The article is published in the following newsgroups:
comp.lang.c,comp.lang.c++,comp.lang.lisp,comp.unix.programmer
comp.lang.python,comp.lang.perl.misc,comp.lang.scheme,comp.lang.java.programmer
comp.lang.functional,comp.object,comp.software-eng,comp.software.patterns

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
D

Dale King

David said:
Also sprach John W. Kennedy:
[...]


Most often, languages with strong typing can be found on the functional
front (such as ML and Haskell). These languages have a dynamic typing
system. I haven't yet come across a language that is both statically and
strongly typed, in the strictest sense of the words. I wonder whether
such a language would be usable at all.


Modula2 claims to be both statically typed and strongly typed. And
your wonder at its usablity is justified.

I used a variant of Modula-2 and it was one of the best languages I have
ever used. That strong, static type checking was a very good thing. It
often took a lot of work to get the code to compile without error.
Usually those errors were the programmers fault for trying to play fast
and loose with data. But once you got it to compile it nearly always worked.
 
T

Tassilo v. Parseval

Also sprach Dale King:
David said:
[...] I haven't yet come across a language that is both statically and
strongly typed, in the strictest sense of the words. I wonder whether
such a language would be usable at all.


Modula2 claims to be both statically typed and strongly typed. And
your wonder at its usablity is justified.

I used a variant of Modula-2 and it was one of the best languages I have
ever used. That strong, static type checking was a very good thing. It
often took a lot of work to get the code to compile without error.
Usually those errors were the programmers fault for trying to play fast
and loose with data. But once you got it to compile it nearly always worked.

I am only familiar with its successor Modula-3 which, as far as I
understand, is Modula-2 with uppercased keywords and some OO-notion
bolted onto it (I still recall 'BRANDED' references).

I have to say that doing anything with this language was not exactly a
delight.

Tassilo
 
A

Anno Siegel

Tassilo v. Parseval said:
Also sprach Dale King:
David said:
On Tue, 24 May 2005 09:16:02 +0200, Tassilo v. Parseval

[...] I haven't yet come across a language that is both statically and
strongly typed, in the strictest sense of the words. I wonder whether
such a language would be usable at all.


Modula2 claims to be both statically typed and strongly typed. And
your wonder at its usablity is justified.

I used a variant of Modula-2 and it was one of the best languages I have
ever used. That strong, static type checking was a very good thing. It
often took a lot of work to get the code to compile without error.
Usually those errors were the programmers fault for trying to play fast
and loose with data. But once you got it to compile it nearly always worked.

I am only familiar with its successor Modula-3 which, as far as I
understand, is Modula-2 with uppercased keywords and some OO-notion
bolted onto it (I still recall 'BRANDED' references).

I have to say that doing anything with this language was not exactly a
delight.

I've been through Pascal, Modula2 and Oberon, and I agree.

These languages had an axe to grind. They were designed (by Niklas
Wirth) at a time of a raging discussion whether structured programming
(goto-less programming, mostly) is practical. Their goal was to prove
that it is, and in doing so the restrictive aspects of the language
were probably a bit overdone.

In the short run they succeeded. For a number of years, languages of
that family were widely used, primarily in educational programming
but also in implementing large real-life systems.

In the long run, the languages have mostly disappeared from the scene.
It has been discovered that "structured programming" is possible in
about any language. It turns out that programmers prefer the
self-discipline it takes to do that in a liberal language over the
enforced discipline exerted by Papa Pascal and his successors.

Anno
 
D

David Formosa (aka ? the Platypus)

On Wed, 1 Jun 2005 06:09:43 +0200, Tassilo v. Parseval

[...]
I am only familiar with its successor Modula-3 which, as far as I
understand, is Modula-2 with uppercased keywords and some OO-notion
bolted onto it (I still recall 'BRANDED' references).

Modula-2 also overused caps, I recall the irratation I found
programing it was irratating, streaching my finger to hit the shift
key or taking me hands of the home keys to bump the CAPSLOCK key
quick became phisically painfull.
 
M

Matthias Buelow

Anno said:
I've been through Pascal, Modula2 and Oberon, and I agree.
In the short run they succeeded. For a number of years, languages of
that family were widely used, primarily in educational programming
but also in implementing large real-life systems.

With a few relaxations and extensions, you can get a surprisingly useful
language out of the rigid Pascal, as evidenced by Turbo Pascal, one of
the most popular (and practical) programming languages in the late 80ies
/ start of the 90ies.

mkb.
 
A

Andrea Griffini

With a few relaxations and extensions, you can get a surprisingly useful
language out of the rigid Pascal, as evidenced by Turbo Pascal, one of
the most popular (and practical) programming languages in the late 80ies
/ start of the 90ies.

It was not a language. It was a product in the hand of a single
company. The difference is that a product can die at the snaps
of a marketroid, no matter how nice or how diffuse it is.

Andrea
 
M

Matthias Buelow

Andrea said:
It was not a language. It was a product in the hand of a single
company. The difference is that a product can die at the snaps
of a marketroid, no matter how nice or how diffuse it is.

Of course it is a language, just not a standardized one (if you include
Borland's extensions that make it practical). But does that matter?
With the exception of Scheme, none of the languages that are the object
of discussion of the newsgroups this thread is being posted to, are
standardized. Yet they are all quite popular.

And btw., I haven't used Pascal in a dozen years but my latest info is
that Turbo Pascal still lives in the form of "Delphi" for the Windows
platform. Surely not "dead" as I understand it.

mkb.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top