From: Pascal J. Bourguignon on
J Kenneth King <james(a)agentultra.com> writes:

> "Scott L. Burson" <gyro(a)zeta-soft.com> writes:
>
>> On Apr 29, 6:42�am, J Kenneth King <ja...(a)agentultra.com> wrote:
>>> grucidipo <gruzci...(a)yahoo.es> writes:
>>> > �I agree, macros are a big win, but the problem I see is that they are
>>> > not easy to standardise, you can construct a new language with macros
>>> > and for others reading your code can be difficult.
>>>
>>> I cannot abide the "construct a new language" argument.
>>>
>>> Macros are a part of Lisp. �They don't modify the language of Lisp.
>>> They don't create new languages inside of Lisp.
> n>
>> Oh, I beg to differ. (And I'm very surprised no one else has
>> challenged this.) How many conversations have we had here about using
>> macros to create domain-specific languages? I did that myself just a
>> few months ago -- used macros to create a specialized variant of CL
>> for use in my pet AI project -- it has firstclass continuations and
>> some other stuff.
>>
>> It is also absolutely the case that people can go crazy with macros
>> just as they can go crazy with, say, operator overloading. I've
>> definitely heard, over the years, of instances where this has
>> occurred. While well-designed macros can very much improve
>> readability of code (as others here have pointed out), poorly-designed
>> ones can make a real mess.
>>
>> Power can always be misused. The question is whether we refuse it, or
>> learn to use it well.
>>
>> -- Scott
>
> It is a matter of logical perspective I was trying to get at.
>
> You are right in every sense.
>
> However, I don't think that distinction was being made.
>
> The poster I was responding to stated that macros can construct a new
> language. This statement has some logical inconsistencies. Macros are
> a part of the ontology of Lisp. When you program using macros, you're
> not programming in new language that is no longer Lisp. Therefore the
> poster's statement is false.

You are assuming some definition of "language" here.

In this discussion, we are writing and reading in English. In
English, we use letters to make words, and words to make sentences. I
can use English words to define new words. For example, I could tell
you that "le" means "the" when the defined noun is male. I could tell
you that "gar�on" means "boy" and is male. I could tell you that
"mange" means "eats". I could tell you that "la" means "the" when the
defined noun is female. I could tell you that "pomme" means "apple"
and is female. Then I could tell you that you can contruct sentences
with the sequence subject verb complement, and that a subject or a
complement can be written as a determining article and a noun. So now
you could, as an English writer/reader, write with things defined
entirely in English text, and using only English text elements (with
the addition of this rare "�" character, but it exists English for
imported words, like "�"), write something like "le gar�on mange la
pomme", and you would argue that this is English.

Good work Kenny!

--
__Pascal Bourguignon__
http://www.informatimago.com
From: J Kenneth King on
pjb(a)informatimago.com (Pascal J. Bourguignon) writes:

> J Kenneth King <james(a)agentultra.com> writes:
>
>> "Scott L. Burson" <gyro(a)zeta-soft.com> writes:
>>
>>> On Apr 29, 6:42 am, J Kenneth King <ja...(a)agentultra.com> wrote:
>>>> grucidipo <gruzci...(a)yahoo.es> writes:
>>>> >  I agree, macros are a big win, but the problem I see is that they are
>>>> > not easy to standardise, you can construct a new language with macros
>>>> > and for others reading your code can be difficult.
>>>>
>>>> I cannot abide the "construct a new language" argument.
>>>>
>>>> Macros are a part of Lisp.  They don't modify the language of Lisp.
>>>> They don't create new languages inside of Lisp.
>> n>
>>> Oh, I beg to differ. (And I'm very surprised no one else has
>>> challenged this.) How many conversations have we had here about using
>>> macros to create domain-specific languages? I did that myself just a
>>> few months ago -- used macros to create a specialized variant of CL
>>> for use in my pet AI project -- it has firstclass continuations and
>>> some other stuff.
>>>
>>> It is also absolutely the case that people can go crazy with macros
>>> just as they can go crazy with, say, operator overloading. I've
>>> definitely heard, over the years, of instances where this has
>>> occurred. While well-designed macros can very much improve
>>> readability of code (as others here have pointed out), poorly-designed
>>> ones can make a real mess.
>>>
>>> Power can always be misused. The question is whether we refuse it, or
>>> learn to use it well.
>>>
>>> -- Scott
>>
>> It is a matter of logical perspective I was trying to get at.
>>
>> You are right in every sense.
>>
>> However, I don't think that distinction was being made.
>>
>> The poster I was responding to stated that macros can construct a new
>> language. This statement has some logical inconsistencies. Macros are
>> a part of the ontology of Lisp. When you program using macros, you're
>> not programming in new language that is no longer Lisp. Therefore the
>> poster's statement is false.
>
> You are assuming some definition of "language" here.
>
> In this discussion, we are writing and reading in English. In
> English, we use letters to make words, and words to make sentences. I
> can use English words to define new words. For example, I could tell
> you that "le" means "the" when the defined noun is male. I could tell
> you that "garçon" means "boy" and is male. I could tell you that
> "mange" means "eats". I could tell you that "la" means "the" when the
> defined noun is female. I could tell you that "pomme" means "apple"
> and is female. Then I could tell you that you can contruct sentences
> with the sequence subject verb complement, and that a subject or a
> complement can be written as a determining article and a noun. So now
> you could, as an English writer/reader, write with things defined
> entirely in English text, and using only English text elements (with
> the addition of this rare "ç" character, but it exists English for
> imported words, like "é"), write something like "le garçon mange la
> pomme", and you would argue that this is English.
>
> Good work Kenny!

You're right as well.

Given that we're defining some definitions, in English, even the
"french" sentence we could still call it English.

I like to think of "new" macro-deigned languages as definitions in
math. We don't mention a figure with three points that are not on the
same line and the lines that connect them when it's more brief to just
call it a triangle. We even create symbols that imply more complex
operations than their brief representation would leave an uneducated
reader to believe.

Am I missing some key point here?
From: Pascal J. Bourguignon on
J Kenneth King <james(a)agentultra.com> writes:

> pjb(a)informatimago.com (Pascal J. Bourguignon) writes:
>
>> J Kenneth King <james(a)agentultra.com> writes:
>>
>>> "Scott L. Burson" <gyro(a)zeta-soft.com> writes:
>>>
>>>> On Apr 29, 6:42�am, J Kenneth King <ja...(a)agentultra.com> wrote:
>>>>> grucidipo <gruzci...(a)yahoo.es> writes:
>>>>> > �I agree, macros are a big win, but the problem I see is that they are
>>>>> > not easy to standardise, you can construct a new language with macros
>>>>> > and for others reading your code can be difficult.
>>>>>
>>>>> I cannot abide the "construct a new language" argument.
>>>>>
>>>>> Macros are a part of Lisp. �They don't modify the language of Lisp.
>>>>> They don't create new languages inside of Lisp.
>>> n>
>>>> Oh, I beg to differ. (And I'm very surprised no one else has
>>>> challenged this.) How many conversations have we had here about using
>>>> macros to create domain-specific languages? I did that myself just a
>>>> few months ago -- used macros to create a specialized variant of CL
>>>> for use in my pet AI project -- it has firstclass continuations and
>>>> some other stuff.
>>>>
>>>> It is also absolutely the case that people can go crazy with macros
>>>> just as they can go crazy with, say, operator overloading. I've
>>>> definitely heard, over the years, of instances where this has
>>>> occurred. While well-designed macros can very much improve
>>>> readability of code (as others here have pointed out), poorly-designed
>>>> ones can make a real mess.
>>>>
>>>> Power can always be misused. The question is whether we refuse it, or
>>>> learn to use it well.
>>>>
>>>> -- Scott
>>>
>>> It is a matter of logical perspective I was trying to get at.
>>>
>>> You are right in every sense.
>>>
>>> However, I don't think that distinction was being made.
>>>
>>> The poster I was responding to stated that macros can construct a new
>>> language. This statement has some logical inconsistencies. Macros are
>>> a part of the ontology of Lisp. When you program using macros, you're
>>> not programming in new language that is no longer Lisp. Therefore the
>>> poster's statement is false.
>>
>> You are assuming some definition of "language" here.
>>
>> In this discussion, we are writing and reading in English. In
>> English, we use letters to make words, and words to make sentences. I
>> can use English words to define new words. For example, I could tell
>> you that "le" means "the" when the defined noun is male. I could tell
>> you that "gar�on" means "boy" and is male. I could tell you that
>> "mange" means "eats". I could tell you that "la" means "the" when the
>> defined noun is female. I could tell you that "pomme" means "apple"
>> and is female. Then I could tell you that you can contruct sentences
>> with the sequence subject verb complement, and that a subject or a
>> complement can be written as a determining article and a noun. So now
>> you could, as an English writer/reader, write with things defined
>> entirely in English text, and using only English text elements (with
>> the addition of this rare "�" character, but it exists English for
>> imported words, like "�"), write something like "le gar�on mange la
>> pomme", and you would argue that this is English.
>>
>> Good work Kenny!
>
> You're right as well.
>
> Given that we're defining some definitions, in English, even the
> "french" sentence we could still call it English.
>
> I like to think of "new" macro-deigned languages as definitions in
> math. We don't mention a figure with three points that are not on the
> same line and the lines that connect them when it's more brief to just
> call it a triangle. We even create symbols that imply more complex
> operations than their brief representation would leave an uneducated
> reader to believe.
>
> Am I missing some key point here?

I think so.

The argument would go saying that Geometry is not the same language as
Arithmetic.


> The poster I was responding to stated that macros can construct a new
> language. This statement has some logical inconsistencies. Macros are
> a part of the ontology of Lisp. When you program using macros, you're
> not programming in new language that is no longer Lisp. Therefore the
> poster's statement is false.

If we define a language as a grammar and a semantics, mapping
sentences recognized by this grammar to a model, then we can usually
easily see what language a set of sentences is written in, and
distinguish sentences written in different languages.


So in the most literal level, a macro can indeed construct a new
language, if it is able to generate the description of a grammar along
with a semantic mapping. For example, the macro could generate a
compiler for this new language. It would have indeed constructed a
new language.

But he didn't mean that and you didn't understood that. At the
slightly above literal level, your are correct that a macro cannot
construct a new language. What macros do is not _construct_ a
language, it's _implementing_ a language! So the poster was formally
incorrect. But this is just being pedantic, so we will have to have a
higher level reading.

So, let's consider a normal macro, for example to define a prolog
language. We could allow a set of functions and macros, or just
expect a single macro as entry point, I think you'll agree that it
wouldn't essentially make any difference in the argument. My point,
is that the sentences written in lisp may be rejected by the macro,
and the sentenses written in the language defined by the macro may be
rejected by lisp. This would prove that we have two different
languages, even if you can call up one from the other.

Even without playing reader tricks with would allow us to write:

(prolog

member(X,[])->false.
member(X,[X|T])->true.
member(X,[Y|T])->member(X,T).

)

we could define our prolog language as:

(prolog
(-> (member ?x ()) false)
(-> (member ?x (?x . ?t)) true)
(-> (member ?x (?y . ?t)) (member ?x ?t)))

Then you could try to write:

(prolog
(loop repeat 3 do (print 'hi)))

or:

(loop repeat 3 do (-> (member ?x (?x . ?t)) true))

and check that in both case you will get errors. Hence the prolog
language (even written in S-EXPs) is not the Lisp language and
vice-versa. QED.


So 2 to 1, you're wrong. ;-)


The fact that you could include a hook to call back lisp in prolog,
(and that obviously we can call prolog from lisp with the PROLOG
macro), doesn't make them the same language.

--
__Pascal Bourguignon__
http://www.informatimago.com
From: J Kenneth King on
pjb(a)informatimago.com (Pascal J. Bourguignon) writes:

> J Kenneth King <james(a)agentultra.com> writes:
>
>> pjb(a)informatimago.com (Pascal J. Bourguignon) writes:
>>
>>> J Kenneth King <james(a)agentultra.com> writes:
>>>
>>>> "Scott L. Burson" <gyro(a)zeta-soft.com> writes:
>>>>
>>>>> On Apr 29, 6:42 am, J Kenneth King <ja...(a)agentultra.com> wrote:
>>>>>> grucidipo <gruzci...(a)yahoo.es> writes:
>>>>>> >  I agree, macros are a big win, but the problem I see is that they are
>>>>>> > not easy to standardise, you can construct a new language with macros
>>>>>> > and for others reading your code can be difficult.
>>>>>>
>>>>>> I cannot abide the "construct a new language" argument.
>>>>>>
>>>>>> Macros are a part of Lisp.  They don't modify the language of Lisp.
>>>>>> They don't create new languages inside of Lisp.
>>>> n>
>>>>> Oh, I beg to differ. (And I'm very surprised no one else has
>>>>> challenged this.) How many conversations have we had here about using
>>>>> macros to create domain-specific languages? I did that myself just a
>>>>> few months ago -- used macros to create a specialized variant of CL
>>>>> for use in my pet AI project -- it has firstclass continuations and
>>>>> some other stuff.
>>>>>
>>>>> It is also absolutely the case that people can go crazy with macros
>>>>> just as they can go crazy with, say, operator overloading. I've
>>>>> definitely heard, over the years, of instances where this has
>>>>> occurred. While well-designed macros can very much improve
>>>>> readability of code (as others here have pointed out), poorly-designed
>>>>> ones can make a real mess.
>>>>>
>>>>> Power can always be misused. The question is whether we refuse it, or
>>>>> learn to use it well.
>>>>>
>>>>> -- Scott
>>>>
>>>> It is a matter of logical perspective I was trying to get at.
>>>>
>>>> You are right in every sense.
>>>>
>>>> However, I don't think that distinction was being made.
>>>>
>>>> The poster I was responding to stated that macros can construct a new
>>>> language. This statement has some logical inconsistencies. Macros are
>>>> a part of the ontology of Lisp. When you program using macros, you're
>>>> not programming in new language that is no longer Lisp. Therefore the
>>>> poster's statement is false.
>>>
>>> You are assuming some definition of "language" here.
>>>
>>> In this discussion, we are writing and reading in English. In
>>> English, we use letters to make words, and words to make sentences. I
>>> can use English words to define new words. For example, I could tell
>>> you that "le" means "the" when the defined noun is male. I could tell
>>> you that "garçon" means "boy" and is male. I could tell you that
>>> "mange" means "eats". I could tell you that "la" means "the" when the
>>> defined noun is female. I could tell you that "pomme" means "apple"
>>> and is female. Then I could tell you that you can contruct sentences
>>> with the sequence subject verb complement, and that a subject or a
>>> complement can be written as a determining article and a noun. So now
>>> you could, as an English writer/reader, write with things defined
>>> entirely in English text, and using only English text elements (with
>>> the addition of this rare "ç" character, but it exists English for
>>> imported words, like "é"), write something like "le garçon mange la
>>> pomme", and you would argue that this is English.
>>>
>>> Good work Kenny!
>>
>> You're right as well.
>>
>> Given that we're defining some definitions, in English, even the
>> "french" sentence we could still call it English.
>>
>> I like to think of "new" macro-deigned languages as definitions in
>> math. We don't mention a figure with three points that are not on the
>> same line and the lines that connect them when it's more brief to just
>> call it a triangle. We even create symbols that imply more complex
>> operations than their brief representation would leave an uneducated
>> reader to believe.
>>
>> Am I missing some key point here?
>
> I think so.
>
> The argument would go saying that Geometry is not the same language as
> Arithmetic.
>
>
>> The poster I was responding to stated that macros can construct a new
>> language. This statement has some logical inconsistencies. Macros are
>> a part of the ontology of Lisp. When you program using macros, you're
>> not programming in new language that is no longer Lisp. Therefore the
>> poster's statement is false.
>
> If we define a language as a grammar and a semantics, mapping
> sentences recognized by this grammar to a model, then we can usually
> easily see what language a set of sentences is written in, and
> distinguish sentences written in different languages.
>
>
> So in the most literal level, a macro can indeed construct a new
> language, if it is able to generate the description of a grammar along
> with a semantic mapping. For example, the macro could generate a
> compiler for this new language. It would have indeed constructed a
> new language.
>
> But he didn't mean that and you didn't understood that. At the
> slightly above literal level, your are correct that a macro cannot
> construct a new language. What macros do is not _construct_ a
> language, it's _implementing_ a language! So the poster was formally
> incorrect. But this is just being pedantic, so we will have to have a
> higher level reading.
>
> So, let's consider a normal macro, for example to define a prolog
> language. We could allow a set of functions and macros, or just
> expect a single macro as entry point, I think you'll agree that it
> wouldn't essentially make any difference in the argument. My point,
> is that the sentences written in lisp may be rejected by the macro,
> and the sentenses written in the language defined by the macro may be
> rejected by lisp. This would prove that we have two different
> languages, even if you can call up one from the other.
>
> Even without playing reader tricks with would allow us to write:
>
> (prolog
>
> member(X,[])->false.
> member(X,[X|T])->true.
> member(X,[Y|T])->member(X,T).
>
> )
>
> we could define our prolog language as:
>
> (prolog
> (-> (member ?x ()) false)
> (-> (member ?x (?x . ?t)) true)
> (-> (member ?x (?y . ?t)) (member ?x ?t)))
>
> Then you could try to write:
>
> (prolog
> (loop repeat 3 do (print 'hi)))
>
> or:
>
> (loop repeat 3 do (-> (member ?x (?x . ?t)) true))
>
> and check that in both case you will get errors. Hence the prolog
> language (even written in S-EXPs) is not the Lisp language and
> vice-versa. QED.
>
>
> So 2 to 1, you're wrong. ;-)
>
>
> The fact that you could include a hook to call back lisp in prolog,
> (and that obviously we can call prolog from lisp with the PROLOG
> macro), doesn't make them the same language.

So very educational.

I suppose I was being pedantic and mistaking it for logical error.

Kudos. ;)