issue-#153 Basic in/out console functionality

Merged to the master branch
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

issue-#153 Basic in/out console functionality

Post by Zinn »

The message was split from viewtopic.php?f=40&t=511
Josef Templ wrote:If anybody wants to engage in debugging this, he will probably find out that logging (using StdLog or Log) cannot be used for the text subsystem itself because StdLog uses the text subsystem for logging and this leads to endless recursion or checked ASSERTions.

For that purpose I am using a primitive low-level logging facility and I have now added this to the wiki.
See http://wiki.blackboxframework.org/index ... le=Console.

- Josef
Should we add the little module Console to subsystem System for debug purpose?
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Some disadvantagies of TextViews Restore

Post by Ivan Denisov »

Zinn wrote:
Josef Templ wrote:If anybody wants to engage in debugging this, he will probably find out that logging (using StdLog or Log) cannot be used for the text subsystem itself because StdLog uses the text subsystem for logging and this leads to endless recursion or checked ASSERTions.

For that purpose I am using a primitive low-level logging facility and I have now added this to the wiki.
See http://wiki.blackboxframework.org/index ... le=Console.

- Josef
Should we add the little module Console to subsystem System for debug purpose?
That is good idea. However it should be done another way. Console should be independent from OS.
https://gitlab.molpit.org/blackbox/free ... onsole.odc
https://gitlab.molpit.org/blackbox/free ... onsole.odc
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#153 Console

Post by Ivan Denisov »

I prepared the test version for the useful Console feature.
It is useful not only for debugging but also for developing of the Console apps.
Please take a look for the System/Docu/Console for the small demonstration.
http://blackboxframework.org/unstable/i ... a1.794.zip

The diffs:
https://redmine.blackboxframework.org/p ... 09ddc6ad20
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#153 Console

Post by Josef Templ »

Ivan Denisov wrote:I prepared the test version for the useful Console feature.
It is useful not only for debugging but also for developing of the Console apps.
Please take a look for the System/Docu/Console for the small demonstration.
http://blackboxframework.org/unstable/i ... a1.794.zip
In which sense is your version more appropriate for developing of Console apps
than my module Console?

I deliberately put my Console feature in a single module because this
is simpler to use.
You just import Console and use it. You can do this even from Kernel.
You have to link only one additional module.
In your version this is not possible.

I deliberately used the same names as in Log/StdLog.
This means that logging can be easily switched from Log/StdLog to Console.

Sorry, but it seems to me that your Console version is not designed carefully.
It is better to stay with the original.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#153 Console

Post by Ivan Denisov »

Console should be independent from OS by the initial design idea and also because there is Linux/OpenBSD/FreeBSD version of BlackBox. We should not forget that all modules in System excepting Kernel should be OS independent. That is why your module can not be included in the distribution in the existing form.

The current realization copies the interface from OpenBUGS project and it's realization is designed well by Alexander Shiryaev.

For switching the log to the console there is separate module. It is OS independent also.
https://gitlab.molpit.org/blackbox/free ... od/Log.odc
However I do not suggest to include it, because it requires extra directory. I do not think, that we ready for such big invention.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#153 Console

Post by Josef Templ »

Ivan Denisov wrote:Console should be independent from OS by the initial design and because there is Linux/OpenBSD/FreeBSD version of BlackBox also. We should not forget that all modules in System except Kernel should be OS independent. That is why your module can not be included in the distribution in the existing form.
Your approach is what I would call "over engineering".
Console is intended for low level debugging of Kernel and other low level modules.
This is the 99% usage. I have used it a lot.
It doesn't give sense to me to try to make this something else and at the same time
forget about its primary usage.

There are other non-portable modules as well that are not located
in Host. For example Math, SMath, CommTCP, SqlODBC, etc.
It doesn't make Console any more portable if you split it.

The only point that I can imagine to be a problem is the line numbering.
It may be inappropriate for a Console app.
But this could easily be made switchable without a complete redesign.
For debugging purposes it is a MUST. Otherwise you get lost
in the output immediately.

You didn't answer my question: in which sense is your Console
better for Console apps?

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#153 Console

Post by Ivan Denisov »

Josef Templ wrote:Your approach is what I would call "over engineering".
It seems so if you do not work with cross-platform development with BlackBox.
Josef Templ wrote:Console is intended for low level debugging of Kernel and other low level modules.
That is only one from many of possible applications. Actually there is console compiler for BlackBox, that uses this console module. I am also using it for my computational servers. It can be used for any console applications.
Josef Templ wrote:It doesn't give sense to me to try to make this something else and at the same time forget about its primary usage.
You are not the only user of the BlackBox!
Josef Templ wrote:There are other non-portable modules as well that are not located
in Host. For example Math, SMath, CommTCP, SqlODBC, etc.
It doesn't make Console any more portable if you split it.
That is lack of design. And we should avoid such cases. Maybe Oberon Microsystems had some reasons to do this for performance. Also Math, SMath is x86 dependent but independent from OS. Comm and Sql is not the main part of BlackBox and designed for some projects... incidentally...
Josef Templ wrote:You didn't answer my question: in which sense is your Console better for Console apps?
Good design allows to develop cross-platform applications. With replace of Host subsystem your app will work without recompiling.

You can watch my video about cross-platform development with BlackBox. It is with Russian comments, however everything is clear from the screencasting.
https://www.youtube.com/watch?v=zxx18LhOr4s
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#153 Console

Post by Josef Templ »

Thanks for the design lesson.

Here is my little contribution to this topic.
(Ivan, it may not convince you, but maybe other center members are
less biased.)

I downloaded Ivan's Console version and tested it with the following
innocent little program:

Code: Select all

MODULE TestConsole;

IMPORT Console;

PROCEDURE HelloWorld*;
BEGIN
	Console.WriteStr("Hello World"); Console.WriteLn;
END HelloWorld;

END TestConsole.
What would you expect as a result?
And what did I get? Please scroll down to see the answer.


















A TRAP.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#153 Console

Post by Ivan Denisov »

You should import HostConsole for your example.

Code: Select all

MODULE TestConsole;

IMPORT HostConsole, Console;

PROCEDURE HelloWorld*;
BEGIN
   Console.WriteStr("Hello World"); Console.WriteLn;
END HelloWorld;

END TestConsole.
We can add this HostConsole import in the HostMenus module for been prevented from the situation you mentioned. HostConsole should be imported once before using Console.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#153 Console

Post by Ivan Denisov »

Actually your critics even in such sarcastic form leads to good results :-)

This new version is suitable for your example above:
http://blackboxframework.org/unstable/i ... a1.799.zip

The new diff:
https://redmine.blackboxframework.org/p ... 09ddc6ad20
Post Reply