gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] IS PUBLIC, IS PRIVATE, enhanced COPY


From: Michael Anderson
Subject: Re: [open-cobol-list] IS PUBLIC, IS PRIVATE, enhanced COPY
Date: Wed, 26 Jun 2013 16:59:51 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Patrick,

I appreciate your enthusiasm, and I also agree with John!

Cobol has been doing a reliable job for over a half-century, because it is slow to change. Note the long list (hundreds) of deprecated features in Java and similar languages, as compared to COBOL's 11 things deprecated.

OpenCobol has some fundamental benefits compared to other Cobol compilers.

String function not available in other compilers:
    concatenate
    substitute
    trim

OpenCobol is closely married to the C compiler:
I write C code to be linked into my Cobol, to do things that Cobol should NOT be doing.
    I use 'cobc' to compile many of my C programs.
Because OC & C are so close, they easily link and share data types, and memory pointers.

OpenCobol combined with C is the best of both worlds:
    Cobol for processing business transactions.
    C for systems programming, threads, sockets, sigs, and events.

I hear that one day soon we'll have OpenCobol 2.0, with function-id.
    Not sure how this will work, or look.
    I hope 'function-id' will allow local scope, like "local storage"?
    Could be your path to classes and inheritance.

--
mike.

On 06/26/2013 01:52 PM, john Culleton wrote:
On Tue, 25 Jun 2013 18:36:54 -0400
Patrick <address@hidden> wrote:

Hi Everyone

It looks like my post "how does our community work" will go
unanswered. It's not a big deal, it's just that I am not sure how to
handle myself in the community sometimes. I want to post about
something that might upset some people. Please everyone forgive me if
I don't write this just the right way, it's hard to get it just right.

So as everyone can see I am still asking beginner/intermediate
questions with Cobol itself. I would like to contribute to the source
code of open Cobol but I will need some time before I am competent to
do so. I have printed most of the source code in colour and I am
reading through it when I can. It's very well laid out and my main
problem is just trying to understand all of the volume of it.

A couple of years ago I tried to read the source code of Lua. Even
though it is only 18K lines of code, I failed miserably.

I am not young, I am 37, have two kids, Wife, mini-van, mortgage and
small business. However there are many people on this list that have
been coding in Cobol longer then I have been alive.

I don't have much to offer the community outside of enthusiasm but
one thing that I mighty be able to offer is a specific perspective.

I have only been programming for 8 years, part time. In this time I
have learned or tinkered with over 20 languages. I really love Cobol
but it was not until I had enough experience under my belt with other
languages that I had the confidence to ignore what so many people
were saying or accidental implying and give the language a real try.
For those with 40 years experience this might not apply.

One thing that chased me away for a few years was the enormous number
of reserved words.

In this video:
http://www.youtube.com/watch?v=7VcArS4Wpqk

Rob Pike, one of the Google Go language developers said that Go has
only 30 reserved words(or thereabouts) and that the number of
reserved words is roughly proportional to the complexity of the
language. With Cobol weighing in with about 300-400 reserved words, I
thought this must be some sort of whacked language from the past.

It's my understanding that there are more lines of Cobol written then
all other languages combined or at least this was the case fairly
recently. However when I look around there is hardly any presence of
it on the internet. Very few tutorials, very few bindings, little
mailing list and IRC activity . Furthermore the forums seem like
ghost towns and are riddled with trolls and such.

I bought 8 books on object oriented Cobol programming. I thought they
would have the "latest and greatest" examples and best practices. I
thought that once I was up to speed I might be able to help bring the
project up to the 2002 standard. I have tried to read these books but
I just end up skimming and putting them down again. I don't see much
of any value that 2002 OO brings and worse it does not seem to have
been adopted in a universal way and that Cobols' public relations
failure was well under way by the time OO showed up.

These additions could give a mechanism to generate library code and
ought to make me more productive with "advances". The things is, the
more I want from the language, the more I just end up finding it in
Cobol 85.

It seem to me that Cobol 85 is near OO already and is already a damn
good language. The thing is that it was been hard for me to learn
coming from experience with many other "modern" languages.

This has been a terribly long introduction but here is the
potentially useful part......

What if I modified open Cobol to make it's goodness more accessible
to programmers familiar with "modern" languages.

I am really loving sub-programs now. I now understand IS COMMON and
IS GLOBAL. It's perfectly sensible to name them these names and have
a more restricted scope as the unspoken default but it would have
been so much easier for me to understand these concepts if the
reserved words were IS PUBLIC or IS PRIVATE.

What is I modified open Cobol and made a friendly fork call Libre
Cobol? If I synchronized it with open Cobol, could I freeload on the
open Cobol list for advice?

I am thinking that a way to make the language more approachable for
some people would be to add non-standard extensions to the language
but add as little total code as possible.

One of my first ideas was to make IS PRIVATE a reserved word that
does nothing, it's just the default. This would be similar to USAGE
IS DISPLAY. I was thinking that if I made IS PUBLIC a synonym of IS
COMMON, new people would know what it does right away.

I was thinking of creating an OO system that was just slightly more
then what it already is in Cobol 85. For instance many languages have
OO without classes, Lua, JavaScript, IO and even Ada(in a non
prototypical way). Information hiding can be achieved in Cobol 85 and
these other languages by  including programs/functions/procedures
within other programs/functions/procedures. Most of these languages
have reserved words to assist in defining scope as well.

There languages have more powerful module capabilities then we do and
better ways to bring in library code so that it can be accessed
through a clear dot notation( dog.bark()  ). We don't have this but I
was also daydreaming about an enhanced COPY statement that would
bring in multiple sub-programs. For instance COPY
"ls ./dogLib/dog*" . The enhanced copy statement would bring in
everything that a shell command returned. The new files(s) brought in
would still have to be able to access files back in their old
directory that were included as regular COPY statements, it might
give a better library mechanism then just plain COPY.

Very long email..... but"

1)is anyone opposed to a friendly fork?

2)is "IS GLOBAL", the default setting and "IS COMMON" close enough to
what people would expect from "IS PUBLIC", "IS PRIVATE" ?

3)would asking people to prefix their library name files with the
library name "dog-bark.cob" be almost as good as using a dot notation?

Any general comments would be appreciated.

Thanks for reading my very long email-Patrick




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list
To answer the reserved-word question first, you must learn to
misspell. For example instead of date use the word ddate or my-date. If
you want to do OO IMO you are better served by using a language built on
that format from the beginning. There are lots of them. In the words of
Lt. Cdr Grace Murray Hopper (I am quoting from memory) "I don't ask
COBOL to do the work of FORTRAN or FORTRAN to do the work of COBOL."
She said this long before we had Python or Ruby or whatever.

Open Source COBOL is built to the COBOL-85 standard with some bits and
pieces of the COBOL-2002 standard added. But all of Open Source COBOL is
per one standard or the other. This differs from most commercial
compilers which have nonstandard extensions for gui screen handling
etc.

The powers that be that build the COBOL standard keep trying to do what
you are trying to do--turn COBOL into something that competes with OO
languages. This is IMO a foolish endeavor bound to fail. There is
enough functionality to do most business tasks already in COBOL-85.
I say most because I have just asked for a workaround to go from julian
to year-month-day calendar date format. Open COBOL (and presumably the
standard) provides a half dozen function routines for dates but none
that do what I am looking for, alone or in combination. I may have to
write an ugly sub-program to do it. But it will be pure COBOL according
to the standard of course.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]