Project

General

Profile

Feature #485

Initialization for CoCoA-5: file init.cocoa5

Added by Anna Maria Bigatti about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
CoCoA-4 function to be added
Start date:
20 Mar 2014
Due date:
% Done:

100%

Estimated time:
5.00 h
Spent time:

Description

In CoCoA-4 there was a file called init.coc with some "initial" settings.
Now most initialization are done by CoCoALib and by the Interpreter.
The only missing feature is the missing "prealoded" ring QQ[x,y,z].

CoCoA-5 starts with such a ring predefined and called R but is not loaded.
G.Lagorio said it was not easy/clean to load it at interpreter level, but should be done by automatically reading an "init.cocoa5" file.


Related issues

Related to CoCoA-5 - Design #989: init file obligatory?In Progress2016-11-29

History

#1 Updated by Anna Maria Bigatti about 10 years ago

  • Status changed from New to In Progress

This is in fact trivial to do it: we just have to add such file to the packages directory (at it was done in CoCoA-4) and it will be loaded automatically together with the other packages.

I did it in my private copy a long time ago ;-)
Recently a new user asked me about not being able to write polynomials: I think CoCoA would be more friendly if, right at the start, would allow writing x+y.

#2 Updated by John Abbott about 10 years ago

I agree that it is a good idea:
  • beginners will find CoCoA-5 immediately usable (as CoCoA-4 was)
  • advanced users can customize init.cocoa5 how they like

Presumably init.cocoa5 is read after having loaded all (standard) packages.
What happens if init.cocoa5 contains errors? (syntax errors? run-time errors?)
Maybe we don't need to be too careful: a user advanced enough to "play" with init.cocoa5 should also be advanced enough to debug his own problems! :-)

#3 Updated by John Abbott about 10 years ago

The name init.cocoa5 is reasonable; are there any other candidates?
StartUp.cocoa5
settings.cocoa5

[add any more you can think of, then we'll pick our favourite]

#4 Updated by Anna Maria Bigatti about 10 years ago

I would set for init, same as in cocoa-4.
My personal file just contains the line Use R; ;-)

#5 Updated by Anna Maria Bigatti about 10 years ago

  • Assignee set to John Abbott
  • % Done changed from 0 to 10

I thought that would be so easy and now I see a little problem.

CoCoA-5 loads all the files in the directory packages/ with extension .cpkg5.
So, what I did for myself, is to "trick it" by creating the init.cpkg file which contains the single line Use R;
Now, this is not a package (which should start with Package $blah).
And we cannot change ring (i.e. write Use R;) inside a package (and rightly so!).

I think (and now I try to do it) that it should be easy to load the file
- called "init.cocoa5"
- contained in "packageDir" (the default or user defined one)
- after loading all the packages contained in "packageDir".

This seem safe and clean.

#6 Updated by John Abbott about 10 years ago

The init.cocoa5 file should be in a personal location (presumably home directory) and not with the files that form the standard distribution of CoCoA -- typically I would expect CoCoA to be installed for public use in a public place, but each user may want to have his own private init file.

I suppose we could have a global init file which is used if the user has no personal init.cocoa5.

#7 Updated by Anna Maria Bigatti about 10 years ago

Let's do it as in cocoa-4: there was an init file for everyone and an additional userinit file for user preferences.

... as a start we do the init file (as soon as i get my cocoalibb compiling again, my personal copy is broken for unknown reaosns and I can't recover it)

then, when we have time, we can think of the additional userinit.

#8 Updated by Anna Maria Bigatti about 10 years ago

  • Subject changed from file init.cocoa5 to Initialization for CoCoA-5: file init.cocoa5

#9 Updated by John Abbott about 10 years ago

Note that it is common for personal "init" files to have name which begin with dot so that they remain "invisible" when doing ls.

#10 Updated by John Abbott about 10 years ago

  • Target version changed from CoCoA-5.1.0 Easter14 to CoCoA-5.1.1 Seoul14
  • Estimated time set to 5.00 h

#11 Updated by Anna Maria Bigatti over 9 years ago

  • Target version changed from CoCoA-5.1.1 Seoul14 to CoCoA-5.?.?
  • % Done changed from 10 to 50

the general init file now works well.
I don't think there is a particular need for a user init file.
I regard this a low priority..

#12 Updated by John Abbott almost 9 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.1.2 summer 2015

#13 Updated by Anna Maria Bigatti almost 9 years ago

Anna Maria Bigatti wrote:

the general init file now works well.
I don't think there is a particular need for a user init file.
I regard this a low priority..

I confirm what I wrote.
The init file is now read and it set the current ring. Moreover the file is there in case we think of something else which might be useful.

For advanced users: userinit.cocoa5 for personal settings can just be saved into the CoCoA-5/package/ directory and then is automatically read together with all the packages.

I don't think we need to find a solution for multi-users computers.

#14 Updated by Anna Maria Bigatti almost 9 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 60

#15 Updated by Anna Maria Bigatti almost 9 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 60 to 100

No news on this topic for a long time: I guess that's good enough! ;-)

#16 Updated by John Abbott over 7 years ago

Also available in: Atom PDF