jed-users mailing list

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

Re: API


On Sun, Jul 13, 2003 at 03:36:33PM +0000, Joerg Sommer wrote:
> Hi,
> 
> I see many weird functions in the API, they aren't necessary in my eyes.

You are right in many points, however SLang has the burden of a history, so
not everything is elegant from todays point of view... backwards
compatibility makes cleaning up difficult. Some points become outdated by
SLang version 2 though.
 
> exchange_point_and_mark: a wrapper for call("exchange") with a better name

... helps understanding the code (and as you will not call it 100 times, no
problem with time).

> bol_skip_white: for those who forget the functions bol() and skip_white()

keeps things short:

!if (bolp)
  bol_skip_white();
  
vs.  
!if (bolp)
  {
     bol();
     skip_white();
  }   

> go_{up,down}: for those who don't want to clean the stack.

Will be made redundant by the autocleaning mechanism of SLang 2.

 
> Some functions make sense, but the most part is a bloat. They makes it
> hard to learn the API and find the function, that is needed. 

Although, here a telling name helps. So exchange_point_and_mark can be found
by apropos("mark").

> And as the
> top of all, there are maybe more then one function in site.sl, that
> replace a internal function and don't do anything more.
> define newline ()
> {
>    insert_char('\n');
> }
> 
> vs. call("newline")

Unfortunately, internal functions are not found by apropos, are not
documented and there is also no list of them coming with jed...
(I have an incomplete one, that misses the equally named ones)

Also, sometimes the internal function has a different behaviour (like
write_buffer)

Besides this you are right --- maybe it would be better to spend the effort
in documenting internal functions instead of recoding them ;-)
 
> I don't know if slang supports inline-ing, otherwise all these functions
> waste time and space, because (correct me if I'm wrong) a direct call of
> up(1) is faster then up_1().

> Any time ago, Günter told me, that up_1() and go_up() should go into the
> C code, but there aren't any information about this. Is this really
> planed? When will this happen? Which functions are affected?

I intended to say it _might_ go... (But as already stated, instead it will
be made redundant by SLang 2.)

> With all this, I want to say, we should not bloat up the API with all
> these small code snippets, that are written in the same time again like
> the name of a new function (bol_skip_white). It should include really
> needed or often used functions. And we should think about the balance
> between the benefit of a go_up_1 functions and a ()=up(1); Maybe a
> skip_line(-1) could do the same for up and down.

Agreed (but who should do the work?).

Günter

-- 
Milde at ife.et.tu-dresden.de

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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