guile-user
[Top][All Lists]
Advanced

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

Re: Naming conventions


From: Bonface M. K.
Subject: Re: Naming conventions
Date: Wed, 08 Jul 2020 00:51:54 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hi Zelphir \o \o

Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

> Hi Simen!
>
> (comments in between)
>
> On 07.07.20 13:05, Simen Endsjø wrote:
>>
>> Hi, I'm quite new to scheme/lisp and haven't coded in a dynamic
>> language in many
>> years. I notice there are some naming conventions, but I'm not sure
>> how they are
>> used/supposed to be used.
>>
>> - *symbol* :: ? Global scope variable?
>> - SYMBOL :: ? Also global scope variable?
>> - %symbol :: ? private function?
>> - %symbol% :: ? private variable?
>
>
> I have seen the % being used for objects. For example in the Racket docs
> for its GUI library:
> https://docs.racket-lang.org/gui/windowing-overview.html#%28part._.Creating_.Windows%29
>
> I am not sure, whether this is a Racket-only thing.
>
>

It's not only confined in Racket. I've also seen in Guile(which is a
scheme too), moreso in the GUIX project

>> - symbol* :: ? extended version of function with same name?
>> - symbol? :: predicate function returning bool
>> - symbol! :: Non-pure/mutating function?- <<symbol>> :: ?
>> - <symbol> :: ? As a macro parameter, and symbol will be defined  in
>> parent scope..?
>> - <<symbol>> :: ?
>> - type1->type2 :: convertion from type1 to type2
>>
>> What does all of these mean? Are some of them
>> anti-patterns/deprecated? Are there others?
>>
>> I also see functions named type-operation and operation-type. Is one
>> preferable to the other?
>

There was an email that explained this. IMHO this depends on the project
you are working and what part of the code base you are touching. Like
you could do a `vector-length` with makes sense. But also `make-vector`
when you have a struct-like data structure makes sense too. The former
being type-operation and the latter being operation-type. Now this is
up to your good sense IMHO.

>
> Regards,
>
> Zelphir

-- 
Bonface M. K. (https://www.bonfacemunyoki.com)
One Divine Emacs To Rule Them All
GPG key = D4F09EB110177E03C28E2FE1F5BBAE1E0392253F



reply via email to

[Prev in Thread] Current Thread [Next in Thread]