emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* commit 7719734dd7 org-compat.el: New compatibility function `org-random'
@ 2012-09-06 16:01 Achim Gratz
  2012-09-06 17:26 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2012-09-06 16:01 UTC (permalink / raw)
  To: emacs-orgmode


Sorry, but that macro doesn't call `random´ appropriately at all.  No
package should ever use `(random t)´ at all and especially not
repeatedly.  Please make org-random an alias to random.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-06 16:01 commit 7719734dd7 org-compat.el: New compatibility function `org-random' Achim Gratz
@ 2012-09-06 17:26 ` Bastien
  2012-09-06 18:02   ` Achim Gratz
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bastien @ 2012-09-06 17:26 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Sorry, but that macro doesn't call `random´ appropriately at all.  

The real problem is (random t) in previous versions of org-id.el.

Do you mean this should be (random) instead of (random t) in those
versions?  Why?  If so, we can simply get rid of the compatibility
macro and use (random).

> No package should ever use `(random t)´ at all and especially not
> repeatedly.

I thought (random t) was okay especially because related functions
(e.g. org-id-new) are *never* repeated at regular intervals.

Besides, (random t) is documented in Emacs <24.3 and XEmacs.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-06 17:26 ` Bastien
@ 2012-09-06 18:02   ` Achim Gratz
  2012-09-06 18:24   ` Nick Dokos
  2012-09-11 18:01   ` Achim Gratz
  2 siblings, 0 replies; 7+ messages in thread
From: Achim Gratz @ 2012-09-06 18:02 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> The real problem is (random t) in previous versions of org-id.el.

Yes.

> Do you mean this should be (random) instead of (random t) in those
> versions?  Why?  If so, we can simply get rid of the compatibility
> macro and use (random).

That would be the correct thing to do.

>> No package should ever use `(random t)´ at all and especially not
>> repeatedly.
>
> I thought (random t) was okay especially because related functions
> (e.g. org-id-new) are *never* repeated at regular intervals.

That unfortunate misconception is built into many Emacs packages, hence
the effort to finally make this operation a no-op and move the seeding
of the PRNG to the Emacs init code.

> Besides, (random t) is documented in Emacs <24.3 and XEmacs.

Sure, but you still aren't supposed to re-seed a PRNG each time you want
a random number from it.  Especially not with the seeding method that
Emacs used to use.  Each Emacs session should call `(random t)´ exactly
once, in the user init file.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-06 17:26 ` Bastien
  2012-09-06 18:02   ` Achim Gratz
@ 2012-09-06 18:24   ` Nick Dokos
  2012-09-11 18:01   ` Achim Gratz
  2 siblings, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2012-09-06 18:24 UTC (permalink / raw)
  To: Bastien; +Cc: Achim Gratz, emacs-orgmode

Bastien <bzg@altern.org> wrote:

> Achim Gratz <Stromeko@nexgo.de> writes:
> 
> > Sorry, but that macro doesn't call `random´ appropriately at all.  
> 
> The real problem is (random t) in previous versions of org-id.el.
> 
> Do you mean this should be (random) instead of (random t) in those
> versions?  Why?  If so, we can simply get rid of the compatibility
> macro and use (random).
> 
> > No package should ever use `(random t)´ at all and especially not
> > repeatedly.
> 
> I thought (random t) was okay especially because related functions
> (e.g. org-id-new) are *never* repeated at regular intervals.
> 
> Besides, (random t) is documented in Emacs <24.3 and XEmacs.
> 

My understanding is that (random t) is called *once* to seed the RNG -
after that you use (random) or (random N) - where N is a positive integer -
to get the next (pseudo) random number in the sequence (scaled to fit in
[0, N) in the second case).

Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-06 17:26 ` Bastien
  2012-09-06 18:02   ` Achim Gratz
  2012-09-06 18:24   ` Nick Dokos
@ 2012-09-11 18:01   ` Achim Gratz
  2012-09-11 18:30     ` Bastien
  2 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2012-09-11 18:01 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> Do you mean this should be (random) instead of (random t) in those
> versions?  Why?  If so, we can simply get rid of the compatibility
> macro and use (random).

Do you mind if I revert that commit and implement the change?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-11 18:01   ` Achim Gratz
@ 2012-09-11 18:30     ` Bastien
  2012-09-11 19:49       ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-09-11 18:30 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Bastien writes:
>> Do you mean this should be (random) instead of (random t) in those
>> versions?  Why?  If so, we can simply get rid of the compatibility
>> macro and use (random).
>
> Do you mind if I revert that commit and implement the change?

Absolutely not, on the contrary.

Thanks in advance,

PS: I've been busy today with some Emacs issues I thought would 
take less time.  And I've been busy with the website last week,
it always take more time than it seems... and maybe deserves.
But I'm back focusing on Org.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: commit 7719734dd7 org-compat.el: New compatibility function `org-random'
  2012-09-11 18:30     ` Bastien
@ 2012-09-11 19:49       ` Achim Gratz
  0 siblings, 0 replies; 7+ messages in thread
From: Achim Gratz @ 2012-09-11 19:49 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
>> Do you mind if I revert that commit and implement the change?
>
> Absolutely not, on the contrary.

Done.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-11 19:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 16:01 commit 7719734dd7 org-compat.el: New compatibility function `org-random' Achim Gratz
2012-09-06 17:26 ` Bastien
2012-09-06 18:02   ` Achim Gratz
2012-09-06 18:24   ` Nick Dokos
2012-09-11 18:01   ` Achim Gratz
2012-09-11 18:30     ` Bastien
2012-09-11 19:49       ` Achim Gratz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).