Re: [Pharo-users] Macros?

2018-06-11 Thread Richard O'Keefe
I've been reconstructing an old programming language. It originally had a very simple but awkward macro facility: if an identifier was declared as a macro, whenever it was called, it could inspect/consume as much of the remaining tokens as it wished and could splice other tokens in. On top of

Re: [Pharo-users] Macros?

2018-06-11 Thread Michael Forster
On Fri, May 25, 2018 at 10:12 AM, Ben Coman wrote: > > > On 25 May 2018 at 21:22, Debiller 777 wrote: >> >> Well, I've already asked about adding new literals to pharo or Smalltalk >> in general, however this time I have a better idea: >> macros. Can they be added? Because if I understand

Re: [Pharo-users] Macros?

2018-05-26 Thread Norbert Hartl
I need to say that this is not a good use case. First and most important is that you should not have deployment switches in your code. Your system should be configured for a special deployment mode not detecting in code. Second but not least important you add references to test classes in your

Re: [Pharo-users] Macros?

2018-05-26 Thread Denis Kudriashov
2018-05-26 9:33 GMT+03:00 Clément Bera : > > > On Sat, May 26, 2018 at 8:07 AM, Denis Kudriashov > wrote: > >> Hi >> >> 2018-05-26 8:46 GMT+03:00 Clément Bera : >> >>> Just mentioning another use-case: >>> >>>

Re: [Pharo-users] Macros?

2018-05-26 Thread Clément Bera
On Sat, May 26, 2018 at 8:07 AM, Denis Kudriashov wrote: > Hi > > 2018-05-26 8:46 GMT+03:00 Clément Bera : > >> Just mentioning another use-case: >> >> getDatabaseInstance >> ^ (Production CifTrue: [Database] CifFalse: [MockDatabase]) new >> > >

Re: [Pharo-users] Macros?

2018-05-26 Thread Denis Kudriashov
Hi 2018-05-26 8:46 GMT+03:00 Clément Bera : > Just mentioning another use-case: > > getDatabaseInstance > ^ (Production CifTrue: [Database] CifFalse: [MockDatabase]) new > I think following code will work: getDatabaseInstance ^ (Production ifTrue: [Database]

Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
Just mentioning another use-case: getDatabaseInstance ^ (Production CifTrue: [Database] CifFalse: [MockDatabase]) new Since I use conditional compilation more often than just precompiling constants. I don't see an equivalent of asMethodConstant AST manipulation at runtime strategy in the

Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
On Fri, May 25, 2018 at 10:44 PM, Esteban Lorenzano wrote: > > > On 25 May 2018, at 17:30, Clément Bera wrote: > > What about a preprocessor like the Java preprocessors ? The Truffle > project relies heavily on that for high performance Java and it's

Re: [Pharo-users] Macros?

2018-05-25 Thread Esteban Lorenzano
> On 25 May 2018, at 17:30, Clément Bera wrote: > > What about a preprocessor like the Java preprocessors ? The Truffle project > relies heavily on that for high performance Java and it's quite nice. It's > difficult to do that in Smalltalk right now. > > I think if

Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
What about a preprocessor like the Java preprocessors ? The Truffle project relies heavily on that for high performance Java and it's quite nice. It's difficult to do that in Smalltalk right now. I think if you want to do what are asking for you just need to write a bytecode compiler extension.

Re: [Pharo-users] Macros?

2018-05-25 Thread Ben Coman
On 25 May 2018 at 21:22, Debiller 777 wrote: > Well, I've already asked about adding new literals to pharo or Smalltalk > in general, however this time I have a better idea: > macros. Can they be added? Because if I understand correctly they may be > the only way to do

Re: [Pharo-users] Macros?

2018-05-25 Thread Stephan Eggermont
Debiller 777 wrote: > Well, I've already asked about adding new literals to pharo or Smalltalk in > general, however this time I have a better idea: > macros. Can they be added? Because if I understand correctly they may be > the only way to do that. Why do you think

[Pharo-users] Macros?

2018-05-25 Thread Debiller 777
Well, I've already asked about adding new literals to pharo or Smalltalk in general, however this time I have a better idea: macros. Can they be added? Because if I understand correctly they may be the only way to do that.