[Gimp-developer] Re: Scheme style, draft 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 28 May 2001, Guillermo S. Romero / Familia Romero wrote:

> shlomif@xxxxxxxxxxxxxxxxxxx (2001-05-28 at 0542.02 +0300):
> > I use spaces to indent, because that's how I configured my editor (gvim).
> > However, some other users may use tabs, and I don't see anything wrong
> > with that.
> 
> What Sven said, any coder should know it. It is a PITA to see how code
> looks differently, and by Murphy's law, the worst look is in the
> printed copy you have to show the teacher (or the one you make public
> if speaking about porjects in general).
> 

Well, I guess using tabs for indentation is considered harmful. But if you
stick to tabs alone, and don't use spaces at all it could work. Of course,
some editors confuse tabs and spaces which brings a lot of trouble.

I usually convert all the tabs that were left out by editting the file
into spaces.

> > style which puts all the ")"'s on the last line. I prefer C-like style
> > like that:
> 
> All lisp users I know will kill you. Dunno why, but they will. Maybe
> it is a secret tradition nobody talks about. I am really newbie, but I
> accepted and passed to make things work. ;]
> 

I don't follow such traditions. It is possible that lisp started before
languages with such indentation emerged (I believe it did) and people
still follow this tradition.

> > I once sent a message to a mailing-list, I'm a member of, asking why the
> > Scheme style was not indeed so. The reply I received did not convince me
> > that it was a good idea. You can find it at:
> > http://groups.yahoo.com/group/hackers-il/message/500
> 
> You use vim, no? Place over a ( or ), and hit %, see how the cursor
> jumps to the matching ) or ( (and % again to go back). Emacs shows
> info as you add the ending ), and you can jump arround with C-M-f and
> C-M-b (keycombos discovered today, BTW, until now I just deleted and
> readded).
>

I'm aware that most editors support such a feature. However, I would also
like to _see_ what is going on in the program structure rather than being
"%"-happy. IMO, C-styling a Scheme code helps me understand where
everything starts and where everything ends. If I rely on using the
editors match-bracket feature, it would take me much more time.

> In general, I think the replies 501 and 503 you got are more or less
> on target, based in all the talk I have seen about it. It is the way
> it has been done mostly, and everybody serious about coding has a nice
> editor that helps and parses whatever languaje you use (view code in a
> web browser? eeek! I hope it has been parsed with one of those apps
> that add colours to source in HTML, at least).
> 

Sometimes one has to work on terminals, for which the terminal program
or the editor does not support colours. I know joe does not, and this is
the editor I use on _terminals_ (on X I use gvim). What I mean is that it
is important for the code to be as readable as possible with or without
syntax-highlighting bracket matching or whatever.

BTW, I do add colours to my source code when publishing it on the web, by
using gvim. If you want to look at the results, check two of my lectures:

http://vipe.technion.ac.il/~shlomif/lecture/Lambda-Calculus/ - A lecture
about Scheme and Lambda Calculus (where I used C-style coding)

http://vipe.technion.ac.il/~shlomif/lecture/Perl/Newbies/ - A
double lecture about introducing Perl for Perl Newbies.

> BTW, if somebody wants to create another lisp version (rep), you can
> not forbid it, mainly cos the project could be that (my Univ is full
> of things nobody will use, but could be, and more if projects were
> planned with that in mind), or cos the person wanted to do it himself.
> I do not see the problem buying furniture done or building your own.
> 

I don't have problem with people creating their own lisp variants, or
new languages in general. Nowadays there is an inflation of new languages,
and sometimes people use the most obscure ones for their projects.

I wonder how many languages can one human brain handle.

> > In any case, if your lines get too long, one should probably out-source
> > part of the code as a different function. Most Script-Fu scripts are
> > almost completely linear so it's not a very big concern.
> 
> Until you call a plugin with ten items.
> 

In that case, you can put each argument in a separate line, like this:

; Totally meaningless code
(gimp-add-new-layer
	myimage
	mylayer
	ALL_WHITE
	6 ; The placement
	;
	; etc. etc.
)

Of course, this is kind of a C style too, but I don't see any reason not
to adopt it.

> > Do you want not to accept scripts that do not follow this regulation?
> 
> As HACKING says, the core things must follow the rules, and the rest
> should too. That way the maintainer job can be passed from ones to
> others as needed, core code or not.
> 
> > > - use "foo" string for logos. [which string? logo name? "the gimp"?]
> > I'd rather people each used the string of each choice. It adds to the
> > scripts' colour. (I really like Bovination's "Fear the Cow")
> 
> Using the name of the script will allow people to see which one
> generates that. Using "The GIMP" will give the origin. Another should
> be to use a phrase with common letters so you see how it will behave,
> ascends and descents, etc. Where is Cameron when we are talking about
> fonts?
> 

But people will usually know which script they used to generate the image.
And after they have liked the script's results, they will want to create
an entirely different text.

> > Script-Fu has the advantage of being easier to compile than the other
> > scripting interfaces. However, for most practical reasons, I believe I
> > would prefer scripting with perl, because I can do everything perl does in
> > Gimp-Perl scripts. (files, sockets, CPAN modules and all)
> 
> IIRC Gimp-Perl is not included in Windows version. I must be sick, cos
> I am caring for Windows users.
> 

I care for Windows users too, and I think we should have a working
Gimp-Perl for Windows. A prerequisite for it would be to have Perl/Gtk+
working on Win32, becuase Gimp-Perl depends on it. Maybe I'll get to
hacking all those things together one day.

In any case, I believe Tor Lilquivist can shed more light on the subject
of why Gimp-Perl for Win32 is not operational.

> > Script-Fu uses SIOD, which is not an R4RS compatible Scheme
> > implementation. (For instance, "set!" can create a new variable). Does
> > anybody know what became of the guile bindings?
> 
> No idea. But making the Python binding default too would be nice. And
> both should have some rules (Python already forces you, anyway).
> 

What do you mean by rules? And what do you mean by both: Python and Perl
or Python and Guile?

In any case, I once tried to create a Script-Fu script that will generate
text which it will extract from a text file, and failed miserably. That's
why I think Script-Fu is not enough for many practical reasons.

Regards,

	Shlomi Fish

> GSR
>  
> _______________________________________________
> Gimp-developer mailing list
> Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
> http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer
> 



----------------------------------------------------------------------
Shlomi Fish        shlomif@xxxxxxxxxxxxxxxxxxx 
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       shlomif@xxxxxxxxxx

A more experienced programmer does not make less bugs. He just realizes
what went wrong more quickly.



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux