Server configuration 'Home' path

Usage of the framework, compiler and tools

Re: Server configuration 'Home' path

Postby a.mcintosh » Tue Nov 29, 2016 11:11 pm

Josef Templ wrote:It is probably worth to consider the export of the startup directory from HostFiles in 1.7.1.
This would be a trivial change and it would not introduce any unwanted side effects
on Locators.


I have an alternate modification to HostFiles so that a client can learn a file path. It does not make any changes to the implementation, but I change the export marking on the following items.
I am not clear whether changing only the implementation with a side effect, or changing only the interface without any implementation changes is the preferred way in the community.

Code: Select all
      File* = POINTER TO RECORD (Files.File)
         name-: FullName;
         
   PROCEDURE (f: File) FINALIZE-;
   PROCEDURE (f: File) NewReader* (old: Files.Reader): Files.Reader;
   PROCEDURE (f: File) NewWriter* (old: Files.Writer): Files.Writer;
   PROCEDURE (f: File) Length* (): INTEGER;
   PROCEDURE (f: File) Flush*;
   PROCEDURE (f: File) Register* (name: Files.Name; type: Files.Type; ask: BOOLEAN; OUT res: INTEGER);
   PROCEDURE (f: File) Close*;
   PROCEDURE (f: File) Closed*(): BOOLEAN;
   PROCEDURE (f: File) Shared*(): BOOLEAN;



Code: Select all
(*2016-11-13 alm
   I wanted to learn what the server / shadow directory path was.  I changes the visibility of HostFiles.File.name to expose that information.
   
   This program tests that behavior.  It does it twice because there is an execution path that is unique for a shared previously existing file.
*)
MODULE AlmPath2;
   IMPORT
      Files, HostFiles, StdLog;
      
   CONST
      Loc1 = "Std/Mod"; Name1 = "Api.odc";
      Loc2 = "Alm/Mod"; Name2 = "Path.odc";

   PROCEDURE ShowAbsoluteFileName*;
      VAR
         loc : Files.Locator;
         f1, f2, f3 : Files.File;
         thisName1, thisName2 : HostFiles.FullName;
         
   BEGIN
      StdLog.Ln;      
      loc := Files.dir.This( Loc1 );
      f1 := Files.dir.Old( loc, Name1, TRUE );
      IF f1=NIL THEN StdLog.String( "file not opened: " ) ELSE StdLog.String( "file opened: ") END;
      StdLog.String( "FullName --> " + f1(HostFiles.File ).name$); StdLog.Ln;
      
      StdLog.Ln; StdLog.Ln;
      loc := Files.dir.This( Loc2 );
      f2 := Files.dir.Old( loc, Name2, TRUE );
      IF f2=NIL THEN StdLog.String( "file not opened: " ) ELSE StdLog.String( "file opened: ") END;
      StdLog.String( "FullName --> " + f2(HostFiles.File ).name$); StdLog.Ln;
      END ShowAbsoluteFileName;
   
END AlmPath2.

 AlmPath2.ShowAbsoluteFileName
User avatar
a.mcintosh
 
Posts: 4
Joined: Tue Sep 17, 2013 12:52 am
Location: Austin, TX

Re: Server configuration 'Home' path

Postby Josef Templ » Wed Nov 30, 2016 9:09 pm

a.mcintosh wrote:
I have an alternate modification to HostFiles so that a client can learn a file path. It does not make any changes to the implementation, but I change the export marking on the following items.
I am not clear whether changing only the implementation with a side effect, or changing only the interface without any implementation changes is the preferred way in the community.

Code: Select all
      File* = POINTER TO RECORD (Files.File)
         name-: FullName;
         
   PROCEDURE (f: File) FINALIZE-;
   PROCEDURE (f: File) NewReader* (old: Files.Reader): Files.Reader;
...




My understanding is that BlackBox deliberately does not export some things.
That is exactly why it is called "BlackBox".
So, exporting the implementation is of course possible from a technical point of view but
it seems to contradict the design philosophy of abstraction from implementation.

- Josef
Josef Templ
 
Posts: 231
Joined: Tue Sep 17, 2013 6:50 am

Previous

Return to Common questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron