Example where static variables are unavoidable... does it exist?

T

TGOS

One way to think of
what you are trying to do is to design a object engine, where the objects and
the engine between them define the runtime semantics of *any* language that is
implemented on top of those objects. I.e. the syntax of the language is
largely unimportant, but the behaviour of the objects is key.

If that's the route that you are going then you are at some risk of
re-inventing* Smalltalk.

No, just a language with a concept similar to Smalltalk, not quite the
same. After all, I already said "Smalltalk is a better paragon than
Java".
Bullshit like this -- I'm sorry, I can think of no more accurate term -- is a
poor way to repay the people (myself included) over on comp.lang.Smalltalk who
are trying to help you understand the language.

Are you married with Smalltalk? I mean, there is no reason to feel
insulted because I dislike one language of your choice. I write programs
in many languages and if I'd feel offended each time someone doesn't
like one of them... I had to feel offended all the time as there's
always someone who doesn't like one of them ;-)

What I wrote is how I see the language. Smalltalk is rather on a level
with PHP and PERL, than with Java and C, rather BASIC than Pascal,
rather JavaScript than Assembler. It's very high level, too high level.
Disagree as much as you like, but I claim it's impossible to implement
an operating system kernel in Smalltalk (like a Linux kernel) that can
still run at usable speed.

And the syntax is ugly. It uses space as separator... very bad idea. No
other reasonable language does that. I mean, sure you can use spaces
like

int a = 10 + 20;

but you don't have to:

int a=10+20;

There is a reason why other OO languages have a separtor between object
and method name that is not space. And it's very hard to distinguish
object, method and parameters in the first place in Smalltalk. It's a
foolish attemp to build a syntax like a real spoken language (kinda like
AppleScript, that tries to imitate the English language, but have you
ever programmed with AppleScript? Horrible!).

In no other language distinguishing code from comments was so difficult
as in Smalltalk. I know how Smalltalk comments look like, but using
quotations for them is just harder to read than comment chars used by
all the other languages (except BASIC, in most BASIC dialects comments
are hard to read as well, e.g. REM lines).

Just look at code like that:

"Generated from the UML suite

Project: Smalltalk

System: sys"



Object subclass: #Account

instanceVariableNames: 'amount'

classVariableNames: ''

poolDictionaries: ''

category: 'sys'!



!Account class methodsFor: 'instance creation'!



new

"Generated"

^super new initialize! !



!Account methodsFor: 'initialize-release'!



release

super release.

"Start user added code"!



initialize

"Start user added code"! !



!Account methodsFor: 'accessing'!



amount

"Generated"

^amount! !



!Account methodsFor: 'misc'!



printAmount

"Not yet implemented"! !



!Account methodsFor: 'modifying'!



amount: anAmount

"Generated"

amount := anAmount! !



Where do methods start, where do they end? Start and end aren't even
marked. Same for classes. This makes it hard to recognize scoping.

It's not that I'm in love with the C syntax. I programmed most of my
life in Pascal and before that in BASIC only. And if it makes you happy,
I hate most of the PERL syntax, too (while I think PHP is quite
acceptable, as it's "clean" than PERL).
 
T

TGOS

Smalltalk is the first object-oriented language I encountered.
Probably when you were still in kindergarten.

I see. IOW, you are trying to say that you are very old, maybe too old
to follow my mind flow. You know "old dogs don't learn new tricks".
 
T

TGOS

If you don't define various core subsets, how have you any hope of
WORA when everything is optional? It would be like writing SQL.

What's wrong with SQL? I use it daily and it works very well across
various databases.

Basically, I think about it like that:
Instead of editions, you create "profiles". Every "profile" defines that
certain classes are present and it also defines all methods of these
classes and what they do.

So if I write a program, I know what classes I must use for it and so I
can later on say "This program will run on all VMs that fullfil the abc
profile, the cde profile and the fgh profile". This might be VMs that
only support these three profiles or VMs that support hundreds of
profiles and these three are included.

However, the core VM would always be the same and alway suppor the same
core set of classes. Regardless if mobile phone or server, it's always
the same core set. The user can download the core set and "profile sets"
to support certain profiles, but these are optional (but might be
required to run a piece of software they want to use). There might be a
"mobile phone" profile, however, also people using a normal PC can
install it.

The VM might download profiles dynamically during runtime when you start
up a program for the first time as needed. It's comparable to Java
packages, with the exception that profiles don't base upon each other
(no profile does need any other profile to be installed, except the core
classes) and that the user can start with no profiles at all and later
on just add the profile sets for the programs he plans to run (or the VM
will add these automatically). Profile classes that are written for a
cell phone and make no sense on a PC will still exist for PC, but they
either will try to emulate the cell phone behavior or maybe do nothing
(e.g. sending a SMS may just pop-up a window on a PC, showing the SMs
text and the recipient, as the PC can't really send this SMS).
 
T

TGOS

I think you are wrong here. There is no way it could contain only what
YOU need and nothing else.

Can I have an operating system kernel, that only contains what I need?
Microsoft says NO, but this is the SMS way of thinking! I actually
already have such a kernel, it's a Linux kernel, I compiled it and it
only contains support for exactly the hardware devices and software
functions that I need.


And reinventing the wheel is nothing negative. If we hadn't reinvented
the wheel many times during history, it would still be made out of
stone.
 
R

Randall R Schulz

Whether or not that's true of dogs, I don't know, but I am not a dog
and I learn new things, not all of them tricks, every day.

Only the foolish young equate middle age and beyond with intellectual
torpor.

You need to put up or shut up. Programming language critics are a dime
a dozen. Useful new concepts are a lot less common and individuals who
create and implement useful new concepts are downright rare.

As I said, when you've got something but vague notions of a superior
language, please show us all. If it's for real, you'll have earned
your laurels.

Until then, it's just a lot of talk.

Randall Schulz
 
R

Roedy Green

Can I have an operating system kernel, that only contains what I need?
Microsoft says NO, but this is the SMS way of thinking! I actually
already have such a kernel, it's a Linux kernel, I compiled it and it
only contains support for exactly the hardware devices and software
functions that I need.

You switched contexts on me. I was defending including all this stuff
in the DOWNLOAD, not the executable.
 
C

Chris Uppal

TGOS said:
Are you married with Smalltalk? I mean, there is no reason to feel
insulted because I dislike one language of your choice.

Not at all, I'm objecting to your spreading your misconceptions as if they were
facts. If (in this case Smalltalk) were really how you described it then not
only would I have no objection to you, personally, not caring much for it (that
is after all only an opinion -- not that you presented it as such), but I would
probably share your opinion. However, that's not what's happening. What's
happening seems to be that you are looking at a small subset of the facts,
making a wild assumption about what the rest of the facts are, ignoring the
context of the few facts you do know, and coming up with what, as I said, can
only be called bullshit.

For instance:
And the syntax is ugly. It uses space as separator... very bad idea.
No
other reasonable language does that. I mean, sure you can use spaces
like

int a = 10 + 20;

but you don't have to:

int a=10+20;

If you find the syntax ugly, then fair enough. I *seriously* doubt whether
you've looked at enough Smalltalk code to have formed a worthwhile opinion
yet. For instance, I can only assume that your assertion that "It uses space
as separator" is coming from the process I outlined above. Smalltalk uses
whitespace in *exactly* the same way as most other languages.

Another example:
Where do methods start, where do they end? Start and end aren't even
marked. Same for classes. This makes it hard to recognize scoping.

This is ignorance speaking again. If you look at Smalltalk code in the
expected way then it is *absolutely* clear where methods (and classes) end. In
fact it is a good deal clearer than in -- say -- Java (where you are dependent
on the class or method having been formatted "sensibly" to be able to tell).
The bits of code that you posted are in a format (called "file-out", or
"chunked") that is *not intended for humans to read*.

Anyway, I have become tired of your attitude. Signing off...

-- chris
 
R

Roedy Green

In Forth, space always separates tokens. Someone coming from one of
the Fortran family (Fortran,C,Java) where you can bunch things
together, that looks extravagant.

However, it has a huge advantage. It uses the low level token parsing
visual wetware. Your eye can EASILY break in things into logical
lumps when they are separated by space. That is why English insists on
a space after commas and periods.

To parse otherwise, you must waste higher brain function, which
analyses which symbols act as separators.

It gets really goofy if you exploit the ability to scrunch in code
like this:
c---++d
 
D

Dale King

I kind of expected TGOS to respond to this, but have yet to see any
response. Trying again just in case the message never made it to the
internet (it has happened before).
 
W

Wojtek

In Forth, space always separates tokens. Someone coming from one of
the Fortran family (Fortran,C,Java) where you can bunch things
together, that looks extravagant.

However, it has a huge advantage. It uses the low level token parsing
visual wetware. Your eye can EASILY break in things into logical
lumps when they are separated by space. That is why English insists on
a space after commas and periods.

To parse otherwise, you must waste higher brain function, which
analyses which symbols act as separators.

It gets really goofy if you exploit the ability to scrunch in code
like this:
c---++d

But then you could code the entire app on one line.

Or each piece on its own line:
c--
-
++d

Or some other wierd combination of indenting, newlines, comments etc.

This is really coding style.

I much prefer having the option of how I organize the human readable,
visual aspect of my code, rather than being forced into an arbitrary
coding style just to keep some compiler happy. COBOL, RPG, and the
other languages of that kind drive me batty. White space should NOT be
significant.

Which is why we have automatic formatters. You format code your way, I
can have it reformatted to my way, etc.
 
R

Roedy Green

I much prefer having the option of how I organize the human readable,
visual aspect of my code, rather than being forced into an arbitrary
coding style just to keep some compiler happy.

The reason for coding conventions is not to keep compilers happy.
They will eat excrement if you teach them how.

It is to make it easy for others to understand you code. You are
primarily communicating with other programmers not with a machine.

THAT is why it is best to use idioms and stereotypes. It means less
brain power has to be spent analysing your code. If you use idioms
they can be grasped in a gestalt, without analysing every last glyph
in detail.
 
B

Bent C Dalager

White space should NOT be
significant.

You mean, I should be able to write something like this:

packagecom.corp.demo;
importjava.util.*;
publicclassTestClass{
staticpublicfinalintMAGIC_NUMBER=3;
protectedListmyList;
}

:)

Cheers
Bent D
 
W

Wojtek

You mean, I should be able to write something like this:

packagecom.corp.demo;
importjava.util.*;
publicclassTestClass{
staticpublicfinalintMAGIC_NUMBER=3;
protectedListmyList;
}

:)

Yes.

Please note that I am NOT advocating this style of code presentation.
I prefer my code properly indented, with code "paragraphs" separated
by blank lines, comments, Javadoc comments (with HTML markup such as
lists, tables, bold), and whatever else will make your code clearer to
read and understand.

I just do not want to be tied down to a specific formatting style
because of a compiler.
 
W

Wojtek

The reason for coding conventions is not to keep compilers happy.
They will eat excrement if you teach them how.

It is to make it easy for others to understand you code. You are
primarily communicating with other programmers not with a machine.

THAT is why it is best to use idioms and stereotypes. It means less
brain power has to be spent analysing your code. If you use idioms
they can be grasped in a gestalt, without analysing every last glyph
in detail.

Please note that I am NOT advocating this style of code presentation.
I prefer my code properly indented, with code "paragraphs" separated
by blank lines, comments, Javadoc comments (with HTML markup such as
lists, tables, bold), and whatever else will make your code clearer to
read and understand.

I just do not want to be tied down to a specific formatting style
because of a compiler.
 
R

Randall R Schulz

Wojtek said:
...

Please note that I am NOT advocating this style of code presentation.
I prefer my code properly indented, with code "paragraphs" separated
by blank lines, comments, Javadoc comments (with HTML markup such as
lists, tables, bold), and whatever else will make your code clearer to
read and understand.

...


Blank lines? Code divided into "paragraphs?"

I surely thought I was the only one.

RRS
 
W

Wojtek

Blank lines? Code divided into "paragraphs?"

I surely thought I was the only one.

Us old timers code like that. The newbies have not yet had to try to
read their OWN CODE after several years.

:))
 
R

Randall R Schulz

Wojtek,

Us old timers code like that. The newbies have not yet had to try to
read their OWN CODE after several years.

Several years? If you're writing enough code, it fades
after a month or so--and I have a very good memory!

So, old-timer, check out my reminiscences in the


Randall
 
H

Harald Hein

Michiel Konstapel said:
think you've sparked an interesting discussion. Keep asking
questions!

No, it is just some kind of mental wanking. There is absolutely no need
to discuss this:

If he can proof that the language is Turing-complete (sans the infinite
stuff) without static variables, then the answer is: Static variable
are not needed, and there exists no example where static variables are
unavoidable.

But that would be work, and trolling and name calling is much easier.
 
C

Chris Uppal

Randall said:
Blank lines? Code divided into "paragraphs?"

I surely thought I was the only one.

Definitely not the only one.

Unless the method is only one line long...

-- chris
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top