slang-users mailing list

[2018 Date Index] [2018 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users]


Cc 
Bcc 
Subject: Re: slang-2.3.2 released
Reply-To 
In-Reply-To: <20180304235849.4CDB442060B3@xxxxxxxxxxx>
X-Operating-System: Linux 4.12.1-1-max8090

Hi all,

This is to express appreciation.

On Sun, Mar 04, at 06:58 John E. Davis wrote:
> I am pleased to announce the release of version 2.3.2 of the slang
> library.  This version is backwards binary compatible with previous
> versions in the 2.x.y series.

Hi John,

Thanks for the compatibility thing. As you know I am building slang
continuously from the repository. That is since the spring of 2010,
when while I was teaching myself programming in my forty-something,
I wrote many of the coreutils, (named slang-utils on github) in slang.
That project at the time was discontinued violently, because of a sudden
change, but the code from that project still exists to the current one,
usually verbatim.
So this is a release that doesn't mean much for me.
But there are also things that matters much more than a number that
indicates a frozen state in time.

But .. eight years (of I can surely testify, but are more than eight) of
compatibility, usually is big news on the programming language universe,
where even point releases are sometimes incompatible. It does mean
something.

> Version 2.3.2 is primarily a maintenance release.  A notable element
> of this version is that it adds support for the new binary terminfo
> file format introduced by ncurses 6.1 eariler this year.

Again, I do not use slang for the curses thing. I much prefer it to look
at it, primary as a programming language and not as a library. As I told
already to John, while I was working at BLFS at (linuxfromscratch.org)
I've changed the description to emphasize this fact.
But the truth is that nobody feels the need to advertise the language, not
that I care much also, so I plead guilty.

But thanks anyway, since it seems there are people who like to use slang for
the smg/tty stuff. I've been using it also extensively, but because it exists
and its free, and that is an advantage.

But I understand that it might be very boring for you to do this curses
emulation stuff.
As a general belief, i think we should devote our time for things that make us
to feel exciting, so in this case we owe actually a doubled thanks here by
everyone who uses this stuff.

I would like to work in a clear separation, in a stable abstraction level
unbreakable in eternity (though nothing lives forever), an abstraction level
between the interpreter and the library (so i will learn some proper C now in
my fifty-something) all the way to Ithaca.

As for the evolution of the language, is not forbidden to have visions and as
such, so i do, some of them are already expressed as thoughts to John but with
code also (prototypes written in slang).

The good thing is that the syntax doesn't been affected at all, since is
well established and there is no reason to change a single thing (perhaps only
the way that we are discarding an unwanted stack item).
The fact remains, slang resembles C with few exceptions, most notably that the
stack in slang is dynamical, and your code will fail miserably if you
don't pop() an unwanted returned value. Thus it would be great if we could
write:

   (void) expression();

which is also natural to C programmers and the best of it is that it
shows intentions; but I also understand that is a breaking syntax rule here and
I will not mind a lot, if i will use what we are using now:

   () = expression();
     or
   expression (); pop();

it's not for the typing or anything like that, it's more for the
others that will face slang code for first time (better to be prepared
and follow the flow).


Anonymous Function Interface.
Currently it's not possible to do:

  variable v=
    if (cond)
      1;
    else
      2;

as _if_ is a statement. I've implemented a function interface, which is
written in slang that uses backquotes (multiline strings) to send for
evaluation, which it can also be used for closed environments.
A function with its own private environment.

I think this is the main advantage of functional programming. Controlling the
environment with a way, that always the same given data, will bring the same
result. Always.

But this fact alone, makes it hard to communicate with the outer space,
because there is always an influence from the external state.
So in a way, we have to deal with it.

For slang the main one is the try() blocks, dangerous and overzealous, but
effective.

In my opinion, which is an undecuted opinion (i've never had any kind
of a formal education), for this to work properly,  such statement - because it needs to be one, or if
any other is being used it should be used locally, in the function scope
of block scope, otherwise you are looking for troubles - should be
placed it, in one main function that will know enough for the environment,
and that will be able to redirect the control somewhere safe; and cleaning up
resources and printing enough information about the error.

For this, can we have a way first to:

Get a specific item from the stack, with the same way we get an array
item, like ideally:

  variable var = __argv__[idx];

again the parser might need to break some rules here

Can be also possible to pass the associated array, when the accessed key is a
function reference, the same way that structs do? Sorry for the naive question.

(and speaking for associated arrays) I don't thing that is wise to give
a choice to have support or not for this datatype in any interpreter.
It's now part of the language proper and it doesn't belong to the choices table.

And can we have a couple of unsafe functions, that do not do any kind
of checking? 


Below are some pretty basic functions, that are prototyped in slang
with a bit different semantics than their counterparts.

% like use_namespace, but define the namespace if is not
% defined and then switch
public define __use_namespace (ns)
{
  try
    use_namespace (ns);
  catch NamespaceError:
    {
    eval (`sleep (0.0001);`, ns);
    use_namespace (ns);
    }
}

% like any (), but instead
% returns 1 when [expression or any array element] is zero,
% or zero otherwise
public define anynot (exp)
{
  any (0 == exp);
}

% like is_substrbytes but return all the occurrences of the 
% byte sequence after offset, in a form of a list,
% if offset is NULL or < 1 then offset assumed the first byte
public define __is_substrbytes (src, byteseq, offset)
{
  variable occur= {};
  if (NULL == offset || 1 > offset)
    offset= 1;

  offset-;

  while (offset = is_substrbytes (src, byteseq, offset + 1), offset)
    list_append (occur, offset);

  occur;
}

% like new_exception but don't throw an error
% if exception is already defined
public define __new_exception (exc, super, desc)
{
  try
    new_exception (exc, super, desc);
  catch RunTimeError: {}
}

There are more ideas that I want to share, and I'm sure others
have their onws too, so it will be nice to share, and possible help
John in what he is doing, but there is no rush and no pressure.

> Thanks,
>   John

John,
Personally I do not have a single expectation, neither a single
line of code by you, because you wrote far too many all these years.
And very good code, anyway is the one that I read most of my time. 

So you dont have to write code because you feel obligated, if you
do that way, sorry but we'll loose all the fun - while this excellent
language, which is at its very first steps- is getting evolved.

Again personally I will take anything from now and on as a gift.

Best,
  Αγαθοκλής
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2018 date index] [2018 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]