Fileless C++ environments

M

Marcin Kaliciñski

Hi,

I've been looking for some time for a fileless C++ environment. I mean the
environment where you don't store the program in cpp/h files, but instead
you work with the C++ entities itselves(classes, functions, namespaces
etc.). Have you heard of anything like that working somewhere?

Marcin
 
T

Thomas Matthews

Marcin said:
Hi,

I've been looking for some time for a fileless C++ environment. I mean the
environment where you don't store the program in cpp/h files, but instead
you work with the C++ entities itselves(classes, functions, namespaces
etc.). Have you heard of anything like that working somewhere?

Marcin

I'm confused. Where are the classes stored?
How do you generate new classes?

In embedded systems, many don't have a harddrive or a file system.
Sources reside on a development workstation and the executable is
downloaded on another platform. Is this what you mean by a
fileless C++ environment?

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
H

Hendrik Belitz

Thomas said:
I'm confused. Where are the classes stored?
How do you generate new classes?

I think Marcin means a system where all classes are stored in a database
(for example). AFAIK there is no such thing for the C++ programming
language (and it wouldn't be conform to the standard either). And I don't
see the use of this. To work classbased and not file-based, you only need a
modern IDE which will support you with that type of abstraction. If you
want a fileless environment to save compile time, use a compiler with a
source database.
 
R

Ron Natalie

Marcin Kaliciñski said:
Hi,

I've been looking for some time for a fileless C++ environment. I mean the
environment where you don't store the program in cpp/h files, but instead
you work with the C++ entities itselves(classes, functions, namespaces
etc.). Have you heard of anything like that working somewhere?
IBM tried this at one point. It breaks things. The language defineitely
mandates an ordering to the translation. You can't just randomly rearrange
parts of a C++ program.
 
M

Marcin Kalicinski

Hi all,

I'll try to explain shortly how I see the fileless C++ environment working:

- There are no .h, *.cpp files etc.
- Classes, namespaces, functions etc. and their relations are stored in a
database
- When editing a C++ entity, you only see the code of that entity.
- There is no 'include' preprocessor command, or at least it is not used to
add C++ entities to the program.
- To use some external C++ entity in your program (like a standard library
class), you 'tell' the system that your program uses that entity. You don't
include anything. In a GUI environment this would be probably accomplished
by drag&dropping a name from available entities list into the project, or
something like that.
- To compile the program, the system generates a properly ordered sequence
of all C++ entities you used, and passes this to the compiler. If proper
ordering cannot be found, it means that there are circular references in the
program, and this is just an error.
- If the output sequence is temporarily stored in a file just before
invoking the compiler, there's no need for special compiling tools - an
ordinary file-based compiler can be used.
- To define a sub-entity (a nested class for example) you define a separate
entity, and 'tell' the environment that it is nested in some other. You
don't write class inside class (or if you do so, the environment will
automatically remove it from there).

I'm interested in this kind of environment, because I worked a lot with fair
sized file-based C++ projects, and I find the filesystem a nuisance. There's
an issue of how to split your source code between the files, and then how to
name them. In most cases I would like to have my files named by the names of
C++ entities, and have one entity in one file. But this is not always
possible (see example at the bottom). It usually causes problems where
classes and namespaces are nested inside each other. In this case I used to
split the source files between directories, mimicking the hierarchy of their
nesting in the project (i.e. I usually had a separate dir for each namespace
etc.). But this generally does not work good, because filesystem hierarchy
is something _different_ than C++ hierarchy.

As far as I remember, B. Stroustrup in one of his books (either in TC++PL or
in 'The Design and Evolution of C++') wrote that it's not neccesary for a
C++ program to be stored in files. I don't know if there's anything in the
C++ standard which makes this obligatory?

Example where class B cannot be defined in other file than class A, unless a
weird #include-in-the-middle-of-class is used:

class A {
class B { };
B b;
};


Best regards,
Marcin
 
D

David Fisher

Marcin Kalicinski said:
I'll try to explain shortly how I see the fileless C++ environment working:

- There are no .h, *.cpp files etc.
- Classes, namespaces, functions etc. and their relations are stored in a
database
- When editing a C++ entity, you only see the code of that entity.
- There is no 'include' preprocessor command, or at least it is not used to
add C++ entities to the program.
- To use some external C++ entity in your program (like a standard library
class), you 'tell' the system that your program uses that entity. You don't
include anything. In a GUI environment this would be probably accomplished
by drag&dropping a name from available entities list into the project, or
something like that.

Sounds like "Intentional Programming" - see
http://citeseer.nj.nec.com/simonyi95death.html (click on the "PDF" or
"image" links near the top right corner of the page).

There is also some information at
http://c2.com/cgi/wiki?IntentionalProgramming. A quote from this page:

"All code was stored in a database and the user would only see a text-like
(but graphical layout) rendering of the information stored in that
database."

C++ code is not required to be stored as files; a comment in the standard
says:

"Source files, translation units and translated translation units need not
necessarily be stored as files, nor need there be any one-to-one
correspondence between these entities and any external representation. The
description is conceptual only, and does not specify any particular
implementation." (Section 2.1, paragraph 7:
http://ftp.csci.csusb.edu/dick/c++std/cd2/lex.html).

David F
 
R

Ron Natalie

C++ code is not required to be stored as files; a comment in the standard
says:

"Source files, translation units and translated translation units need not
necessarily be stored as files, nor need there be any one-to-one
correspondence between these entities and any external representation. The
description is conceptual only, and does not specify any particular
implementation." (Section 2.1, paragraph 7:
http://ftp.csci.csusb.edu/dick/c++std/cd2/lex.html).
You need to read that carefully. All it says is you don't have to store
the various phases in disk files. The source code does however have
to be file-like: that is a linear sequence of sourced character set
characters.
There is a definite REQUIRED ordering to C++ source code. You can't
just take them various definitions/declarations in any ordering (or
unordered).

As I pointed out IBM tried this and it became impossible to use.
 

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

Forum statistics

Threads
474,155
Messages
2,570,871
Members
47,401
Latest member
CliffGrime

Latest Threads

Top