[Seaside] How generate ID

John M McIntosh johnmci at smalltalkconsulting.com
Sun Dec 30 09:07:55 UTC 2007


Assuming you want a unique value, and you don't care if it's in order  
then you can just do

UUID new
-> e0090895-4a12-4ef6-82e0-9acefc76ff9c  -> asString36  ->   
'9alvh9w807elbql3xdq6l05pc'

that will be unique.

buf if you must start at 1 and go to infinity then you need to bother  
with
Semaphore forMutualExclusion
and do things like remember what the last number was...
more code and options to get it wrong.


On Dec 29, 2007, at 11:50 PM, Philippe Marschall wrote:

> Just remember stuff like this is not thread-safe, the same is true for
> incrementing too.
>
> Cheers
> Philippe

--
= 
= 
= 
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================




More information about the seaside mailing list