kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

Correct file suffix for K data as K files #636

Open tavmem opened 1 year ago

tavmem commented 1 year ago

When using the command "file" 1: ("a"; 4 5):

Kona

However, the K Reference Manual states:

Load/Save K Data as K Files

1: f
f 1: x

Arguments
The argument f is a symbol atom or character vector, while x is any atom or list. In
the first case, Load K Data (monadic 1:), f may also be a character atom.
Definition
In either case f holds the name of a file, including any directory path information.
The monadic function 1: f loads that file into the workspace as a data object,
which is the result of the function. The dyadic function f 1: x saves the data x
in a file in the format of a K data object. Presumably the monadic function is
applied to a file that has been previously created with the dyadic function.

Note: The actual name of the file referred to by f may differ from the name held in
f, typically by the extent .K on Unix systems and by .L on NT. For example, if f
is "/dir/prices" then the actual file name would be /dir/prices.K on
Unix, or /dir/prices.L on NT. The full file name including the suffix is per-
mitted for f, but is not portable.

All implementations (k2.8, k3.2 and kona) are currently incompatible with the K Reference Manual Note, that there is a "TODO" in the kona source file src/0.c

K _1d(K x,K y) {
  I t=x->t;
  if(4==t || -3==t){
    S m=CSK(x); I sm = strlen(m);
    S e= sm > 1 && '.'==m[sm-2] && *KFX==m[sm-1] ? strdupn(m,sm) : glueSS(m,KFX);
    //TODO: lfop (lower-case l on Windows -- differs from 'L' in manual)

Which is the best way to go?

bakul commented 1 year ago

k3.2 uses .l extension under linux. I think this is better for a data file. .k or .K should be used for K source code files (in ascii).