ThelopWiki

Wards Wiki Pages / Thelop Name Example

This page is intended to give a few examples of ThelopName?'s. They are built from ThelopWord?s according to the ThelopRule?'s.


Some examples using C as host programming language (only prototypes are given):

void StrCpy(char *dest,char *src); ERR FileCpy(char *dest_filename,char *src_filename); ERR ImageCpy(IMAGE *dest_image,IMAGE *src_image); char *Ptr'Create'File(char *filename); IMAGE *Image'CreateImage'Rect(IMAGE *src_image,RECT *pr); size_t File'Ret'Size(char *filename); size_t Str'Ret'Len(char *s); size_t Str'Ret'Size(char *s); void Str'Get'Size(char *s,size_t *psize); void Str'Cvt'Upper(char *s); void Mouse'Get'Pos(WINDOW *w,int *px,int *px); void Window'Set'Pos(WINDOW *w,int x,int x);

You may notice the uncommon usage of the words Get (that is in wide use) and Ret (introduced by THELOP). The word Get tells you that the results of a function are passed by (some kind of) reference:

void Date'GetYearMonth'Day(DATE d,int *pyear,int *pmonth,int *pday);

while the Ret indicates that the result is passed by the function return value:

int Date'Ret'Year(DATE d);

If you use a programming languages that allows these different types of passing results, then the consistent use of Get and Ret is essential.

The ThelopLanguage? tries to enable the programmer to name any existing function correctly and completely. This is a difficult task and usually no fun at all (try any API). The obvious next step is to improve the API and make it consistent and easy to use. If you build a new API then you can DoItRightTheFirstTime?.

---

Gee, instead, why not write function names that people can read:

void stringCopy(char *destination, char *source); Error fileCopy(char *destinationFilename,char *sourceFilename);

etc...Or, better yet, use polymorphism and objects:

String::copy(); File::copy();

There. Isn't that easier to read than all of those cryptic acronyms?


See also: ThelopWordExample?'s, ThelopRule?'s, ThelopLanguage?, ThelopDictionary, LanguageOrientedProgramming
Other examples: ByRefConsideredHarmful?
CategoryThelop?
 
© ThelopWiki Community zuletzt geändert am September 22, 2003