Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5304 > unrolled thread

Re: Re: MakeExpression and color

Started byJohn Fultz <jfultz@wolfram.com>
First post2011-10-01 07:09 +0000
Last post2011-10-02 06:37 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re:  Re: MakeExpression and color John Fultz <jfultz@wolfram.com> - 2011-10-01 07:09 +0000
    Re: MakeExpression and color Alexey Popkov <lehin.p@gmail.com> - 2011-10-02 06:37 +0000

#5304 — Re: Re: MakeExpression and color

FromJohn Fultz <jfultz@wolfram.com>
Date2011-10-01 07:09 +0000
SubjectRe: Re: MakeExpression and color
Message-ID<j66ebr$hdm$1@smc.vnet.net>
I wouldn't call it a compensation.  In fact, it was deliberately designed this 
way all the way from the time boxes were first introduced.

It's not at all bad practice to treat presentation and semantics differently.  
TagBox is deeply about semantics, and it allows you to link presentation aspects 
to those semantics, which is all well and good...but any attempt to build a
semantic layer which depends upon parsing all of the available presentation
information with, at best, heuristics regarding the semantic utility of that
information is going to quickly end in a very frustrating mess.

Sincerely,

John Fultz
jfultz@wolfram.com
User Interface Group
Wolfram Research, Inc.

On Fri, 30 Sep 2011 04:03:55 -0400 (EDT), Arturas Acus wrote:
>
>
> I found that the desired funcionality can be easily realised using
> TagBox[ ] tags. Seems like TagBox[ ] was deliberately introduced in order
> to "compensate" the mentioned MakeBoxes and MakeExpresion asymmetry.
>
>
> On Thu, 29 Sep 2011, Arturas Acus wrote:
>
>> Dear Group,
>>
>> I am trying to "transfer" some useful information from its
>> representation color without success.
>>
>> For example, if a vector (with MakeBoxes) is shown in red, then I want
>> it have a mark v["2D"], if in blue, then v["3D"].
>>
>> Unfortunatelly MakeExpression immediatelly removes all StyleBoxes (the
>> documented feature) and I do not find any way to prevend this.
>> (Interestingly, that MakeExpresion do not have any holding atributes).
>>
>> Can anybody think how to make style box information usefull?
>>
>> My opinion is that mentioned MakeExpression feature is very restrictive
>> and do not allow user to code usefull information in color or shape.
>>
>>
>>
 MakeExpression[HoldPattern[SubscriptBox[RowBox[{StyleBox["\[LeftAngleBracket
>> ]",cr_],
>>=
 name_,StyleBox["\[RightAngleBracket]",cr_]}],grade_]],StandardForm]:=myobjec
>> t[cr]
>>
>>
>> Sincerely, Arturas Acus


[toc] | [next] | [standalone]


#5317

FromAlexey Popkov <lehin.p@gmail.com>
Date2011-10-02 06:37 +0000
Message-ID<j690ra$rcm$1@smc.vnet.net>
In reply to#5304
On 1 Oct, 11:09, John Fultz <jfu...@wolfram.com> wrote:
> I wouldn't call it a compensation.  In fact, it was deliberately designed this
> way all the way from the time boxes were first introduced.
>
> It's not at all bad practice to treat presentation and semantics differently.  
> TagBox is deeply about semantics, and it allows you to link presentation aspects
> to those semantics, which is all well and good...but any attempt to build a
> semantic layer which depends upon parsing all of the available presentation
> information with, at best, heuristics regarding the semantic utility of that
> information is going to quickly end in a very frustrating mess.

But why in this case the only way to get back original definitions for
a symbol goes through parsing of BoxForms backward to "normal"
expressions? For example, if I wish to get back original definitions
for symbol 'f', I am forced to use the following hack and it seems
that there is no other way to get them (all *Values functions does not
respect the difference between immediate and delayed definitions):

MakeExpression[#, StandardForm] & @@ ToBoxes[Definition[f]]

>
> Sincerely,
>
> John Fultz
> jfultz@wolfram.com
> User Interface Group
> Wolfram Research, Inc.

Sincerely,
Alexey

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web