Naming questions

Mildred ml.mildred593 at online.fr
Mon Sep 1 16:21:07 UTC 2008


Hi,

Welcome to Lisaac :)

Le Fri 22/08/2008 à 11:50 Jeremy Cowgar à écrit:
> I have two naming questions:
> 
> 1. What is the difference between create and make ? For instance, I
> adding docs now to my SQLite binding and when comparing to the docs in
> other objects, I noticed sometimes the use of make other times the use
> of create. I have one such slot that takes a sqlite3* pointer from C
> and creates a new SQLITE object from it. Should this be named
> "create" or "make" ? What is the rule in regards to these two names?

the make slot modify the current object. Usually using the values
passed as parameter. This is necessary because there is no way to
modify a slot of an object from another object. For example, it is
impossible to write something like:

	object.slot := value;

The create slot, usually, clone the current object (often the prototype
itself) to create another object, and initialize the created object
using make. And returns it.

Just look at the implementation, it is strainghtforward. usually it is
something like:

	- create val:TYPE :SELF <-
	( + result :SELF
	  result := clone;
	  result.make val;
	  result
	);

	- make val:TYPE <-
	(
	  slot := val;
	);

Personally, I prefer this form (I think it is more smalltalk like):

	- create val:TYPE :SELF <- clone.make val;

	- make val:TYPE :SELF <-
	(
	  slot := val;
	  Self
	)

> 2. What is the rule as to when to use keywords vs. more descriptive
> slot names? For instance:
> 
> - bind_string (col:INTEGER, value:ABSTRACT_STRING)
> - bind_integer (col:INTEGER, value:INTEGER)
> - bind_integer64 (col:INTEGER, value:INTEGER_64)
> ... etc
> 
> -- or --
> 
> - bind col:INTEGER to_string value:ABSTRACT_STRING
> - bind col:INTEGER to_integer value:INTEGER
> - bind col:INTEGER to_integer64 value:INTEGER_64
> ... etc

I would say that you choose. In earlier versions, it was not possible
to group parameters, so keywords were mandatory.
For now, I would say, put them if you can find some keywords. And I
would avoid keywords like 'with' or that has the same name as the type
of the parameter that follows (unless this is necessary to
differentiate different slots).

:)

Mildred





-- 
Mildred Ki'lya
Site:	<http://mildred632.free.fr/>
XMPP:	<mildred at jabber.fr> (GoogleTalk, Jabber)

GPG:	197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]



More information about the Lisaac-devel mailing list