Page 2 of 2

Re: How do I define a keyword as a integer constant?

PostPosted: Mon May 12, 2014 3:39 am
by joeish80829
You mentioned "You cannot. There is no "direct" way to associate a "value" to a keyword without some indirection" is there a way inolving redirection that would be under .10 seconds per million iterations...I could sure use an example

Re: How do I define a keyword as a integer constant?

PostPosted: Mon May 12, 2014 5:13 am
by marcoxa
joeish80829 wrote:You mentioned "You cannot. There is no "direct" way to associate a "value" to a keyword without some indirection" is there a way inolving redirection that would be under .10 seconds per million iterations...I could sure use an example


I go by the maxim "first get it right, then get it fast". What you want is the constant which you initialize beforehand. It's the right way to do it. Forget about the keyword (or hack Emacs/Slime highlighting).

If you want you can do

Code: Select all
(defenum foo ((baz #.(cffi:foreing-enum-value 'foo :baz))) ; etc


Now you will have a mapping to the "constant" BAZ. AFAIU It cannot become faster than that.

Cheers
--
MA

Re: How do I define a keyword as a integer constant?

PostPosted: Thu May 15, 2014 5:07 am
by joeish80829
How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"

Re: How do I define a keyword as a integer constant?

PostPosted: Thu May 15, 2014 5:07 am
by joeish80829
How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"

Re: How do I define a keyword as a integer constant?

PostPosted: Fri May 16, 2014 1:31 am
by marcoxa
joeish80829 wrote:How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"


Well, well, well... I don't know. I just know it is possible. The only enlightened and wise answer is thus: RTFM (either Emacs highlighting, or ask the slime guys) :mrgreen: