A Gentle Introduction to Amber

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
71 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

A Gentle Introduction to Amber

horrido
I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.

https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab

When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
Thanks to Herby's (very extensive) proofreading and vetting, I've made many substantial changes to the article, esp. the coding examples. It's now ready for publishing and I've posted it at Reddit:

http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

It'll be interesting to see what kinds of comments I receive...


On Tuesday, 9 June 2015 12:52:24 UTC-4, Richard Eng wrote:
I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.

<a href="https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;">https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab

When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Martin Bähr
Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
> Thanks to Herby's (very extensive) proofreading and vetting, I've made many
> substantial changes to the article, esp. the coding examples. It's now
> ready for publishing and I've posted it at Reddit:
>
> http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

the article reads nicely, but i wonder, why the excursion on switch? it is not
specific to amber, and it gives the impression that you feel the need to
apologize for it.

this should be an aside linked to a separate post, if it's mentioned at all.

what i would like to know is, if there is a way to not use smalltalk to
generate html, but just have it as plain raw html. the example you give doesn't
demonstrate that the smalltalk variant is easier to read. on the contrary.

i find plain html much nicer to read, and it even looks like smalltalk is more
typing.

also, in day to day work, i very often have to deal with html given to me by
others. i don't write html, our designers do.

having to translate the designers output into smalltalk is just busywork. and
having to update for changes even worse. it's just not practical.

finally though, i really like that you are using a REST api example. that's
right up my alley, and when i find some time i'll try to get this to run.

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      pike.lysator.liu.se    caudium.net     societyserver.org
secretary                                                      beijinglug.org
mentor                                                           fossasia.org
foresight developer  foresightlinux.org                            realss.com
unix sysadmin
Martin Bähr          working in china        http://societyserver.org/mbaehr/

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík


Martin Bähr wrote:

> Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>> Thanks to Herby's (very extensive) proofreading and vetting, I've made many
>> substantial changes to the article, esp. the coding examples. It's now
>> ready for publishing and I've posted it at Reddit:
>>
>> http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>
> the article reads nicely, but i wonder, why the excursion on switch? it is not
> specific to amber, and it gives the impression that you feel the need to
> apologize for it.

+1. I just did not know how to formulate it, but I felt uneasy, too, in
that section.

> this should be an aside linked to a separate post, if it's mentioned at all.
>
> what i would like to know is, if there is a way to not use smalltalk to
> generate html, but just have it as plain raw html. the example you give doesn't
> demonstrate that the smalltalk variant is easier to read. on the contrary.

That code can still be made a little less hairy so as to leave this
impression with less probability.

> i find plain html much nicer to read, and it even looks like smalltalk is more
> typing.

Programmatic generation of HTML does seems awkward and longer at the
first look, compared to plain HTML. But it is just a different paradigm,
and not without its cons. HTML is a string, programmatically generated
HTML (or, DOM content) is objects and code. This allows for more
algorithmic approach to manipulating content.

One of the big proponents of this approach is Seaside, an acclaimed Web
library for server-side Smalltalks. The whole paradigm, naturally to
Smalltalk where everything is an object, was to generated HTML
programmatically, reusing higher level components and assembling the
page form them. Web library draws inspiration from Seaside, though it is
different, being on client side.

Other programmatic generation of HTML is MochiKit, which inspired AppJet
platform of 2009-2012, and is an inspiration for different Amber
library, Silk.

> also, in day to day work, i very often have to deal with html given to me by
> others. i don't write html, our designers do.
>
> having to translate the designers output into smalltalk is just busywork. and
> having to update for changes even worse. it's just not practical.

Web library has an advanced feature called snippets, where you can
define pieces of HTML, properly marked, in a page; each one allows you
to define "virtual tags". Upon startup, Web library removes them and
remembers them for later use. Then you can do

   html foo with: [ .... ]

and the clone of your snippet is inserted, with [ ... ] put at the
designated insertion point.

> finally though, i really like that you are using a REST api example. that's
> right up my alley, and when i find some time i'll try to get this to run.
>
> greetings, martin.

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Ricardo Moran
Hi, 

Just a suggestion on the "switch" issue. Why not take the opportunity to show how easy it is to extend base classes with new functionality (even control statements) by implementing the Object>>#caseOf:otherwise: method that Squeak and Pharo have?

I just tested this on the amber website and it works:

Object>>caseOf: aBlockAssociationCollection otherwise: aBlock
"The elements of aBlockAssociationCollection are associations between blocks.
Answer the evaluated value of the first association in aBlockAssociationCollection
whose evaluated key equals the receiver.  If no match is found, answer the result
of evaluating aBlock."
aBlockAssociationCollection do:
[:assoc | (assoc key value = self) ifTrue: [^assoc value value]].
^ aBlock value
Then your example becomes:

inputValue caseOf: {
#value1 -> ["do something"].
#value2 -> ["do something"].
#value3 -> ["do something"]
} otherwise: ["do something by default"]

Best regards,
Richo

On Thu, Jun 11, 2015 at 7:20 AM, Herby Vojčík <[hidden email]> wrote:


Martin Bähr wrote:
Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
Thanks to Herby's (very extensive) proofreading and vetting, I've made many
substantial changes to the article, esp. the coding examples. It's now
ready for publishing and I've posted it at Reddit:

http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

the article reads nicely, but i wonder, why the excursion on switch? it is not
specific to amber, and it gives the impression that you feel the need to
apologize for it.

+1. I just did not know how to formulate it, but I felt uneasy, too, in that section.

this should be an aside linked to a separate post, if it's mentioned at all.

what i would like to know is, if there is a way to not use smalltalk to
generate html, but just have it as plain raw html. the example you give doesn't
demonstrate that the smalltalk variant is easier to read. on the contrary.

That code can still be made a little less hairy so as to leave this impression with less probability.

i find plain html much nicer to read, and it even looks like smalltalk is more
typing.

Programmatic generation of HTML does seems awkward and longer at the first look, compared to plain HTML. But it is just a different paradigm, and not without its cons. HTML is a string, programmatically generated HTML (or, DOM content) is objects and code. This allows for more algorithmic approach to manipulating content.

One of the big proponents of this approach is Seaside, an acclaimed Web library for server-side Smalltalks. The whole paradigm, naturally to Smalltalk where everything is an object, was to generated HTML programmatically, reusing higher level components and assembling the page form them. Web library draws inspiration from Seaside, though it is different, being on client side.

Other programmatic generation of HTML is MochiKit, which inspired AppJet platform of 2009-2012, and is an inspiration for different Amber library, Silk.

also, in day to day work, i very often have to deal with html given to me by
others. i don't write html, our designers do.

having to translate the designers output into smalltalk is just busywork. and
having to update for changes even worse. it's just not practical.

Web library has an advanced feature called snippets, where you can define pieces of HTML, properly marked, in a page; each one allows you to define "virtual tags". Upon startup, Web library removes them and remembers them for later use. Then you can do

  html foo with: [ .... ]

and the clone of your snippet is inserted, with [ ... ] put at the designated insertion point.

finally though, i really like that you are using a REST api example. that's
right up my alley, and when i find some time i'll try to get this to run.

greetings, martin.

Herby


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
In reply to this post by Martin Bähr
I've moved the Case Statement section into a separate article:

https://medium.com/@richardeng/smalltalk-doesn-t-have-a-case-statement-5a05e0b8ff51

And thanks to Ricardo Moran for the suggestion on how to extend Smalltalk with a Case Statement.


On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
> Thanks to Herby's (very extensive) proofreading and vetting, I've made many
> substantial changes to the article, esp. the coding examples. It's now
> ready for publishing and I've posted it at Reddit:
>
> <a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

the article reads nicely, but i wonder, why the excursion on switch? it is not
specific to amber, and it gives the impression that you feel the need to
apologize for it.

this should be an aside linked to a separate post, if it's mentioned at all.

what i would like to know is, if there is a way to not use smalltalk to
generate html, but just have it as plain raw html. the example you give doesn't
demonstrate that the smalltalk variant is easier to read. on the contrary.

i find plain html much nicer to read, and it even looks like smalltalk is more
typing.

also, in day to day work, i very often have to deal with html given to me by
others. i don't write html, our designers do.

having to translate the designers output into smalltalk is just busywork. and
having to update for changes even worse. it's just not practical.

finally though, i really like that you are using a REST api example. that's
right up my alley, and when i find some time i'll try to get this to run.

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      <a href="http://pike.lysator.liu.se" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">pike.lysator.liu.se    <a href="http://caudium.net" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">caudium.net     <a href="http://societyserver.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">societyserver.org
secretary                                                      <a href="http://beijinglug.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">beijinglug.org
mentor                                                           <a href="http://fossasia.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">fossasia.org
foresight developer  <a href="http://foresightlinux.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">foresightlinux.org                            <a href="http://realss.com" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">realss.com
unix sysadmin
Martin Bähr          working in china        <a href="http://societyserver.org/mbaehr/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Bert Freudenberg-5
In reply to this post by horrido
On 11.06.2015, at 05:40, Richard Eng <[hidden email]> wrote:

Thanks to Herby's (very extensive) proofreading and vetting, I've made many substantial changes to the article, esp. the coding examples. It's now ready for publishing and I've posted it at Reddit:


It'll be interesting to see what kinds of comments I receive…

I’d appreciate if you did not use such an overtly sexist lead.

- Bert -



On Tuesday, 9 June 2015 12:52:24 UTC-4, Richard Eng wrote:
I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.

<a href="https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;" class="">https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab

When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík


Bert Freudenberg wrote:

> On 11.06.2015, at 05:40, Richard Eng <[hidden email]
> <mailto:[hidden email]>> wrote:
>>
>> Thanks to Herby's (very extensive) proofreading and vetting, I've made
>> many substantial changes to the article, esp. the coding examples.
>> It's now ready for publishing and I've posted it at Reddit:
>>
>> http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>>
>> It'll be interesting to see what kinds of comments I receive…
>
> I’d appreciate if you did not use such an overtly sexist lead.

I'd appreciate in political correctness went to hell.

Herby

> - Bert -

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
In reply to this post by Martin Bähr
It's very easy to insert raw HTML instead of using HTMLCanvas. For example,

 '#client-main' asJQuery append:
     
'<form>
     <table>
     <tr><td>Username:</td><td><input name="name"></td></tr>
     <tr><td>Password:</td><td><input name="password" type="password"></td></tr>
     <tr><td><input type="submit" value="Okay"></td></tr>
     </table>
     </form>'

I just thought it'd be nice to use Smalltalk to programmatically create the HTML. I used Seaside many years ago, so it's what I'm familiar with; in Seaside, there was no other way to use HTML (most web frameworks use HTML templates).

In fact, for all future work, I'm inclined to inject raw HTML. It's much more flexible than the programmatic approach and is much more natural for Amber (than it is for Pharo). However, I still need to solve the issue of

(('#myForm1 *' asJQuery) filter: ':input')

crapping out on me when a false value causes a break from the loop.


On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
> Thanks to Herby's (very extensive) proofreading and vetting, I've made many
> substantial changes to the article, esp. the coding examples. It's now
> ready for publishing and I've posted it at Reddit:
>
> <a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

the article reads nicely, but i wonder, why the excursion on switch? it is not
specific to amber, and it gives the impression that you feel the need to
apologize for it.

this should be an aside linked to a separate post, if it's mentioned at all.

what i would like to know is, if there is a way to not use smalltalk to
generate html, but just have it as plain raw html. the example you give doesn't
demonstrate that the smalltalk variant is easier to read. on the contrary.

i find plain html much nicer to read, and it even looks like smalltalk is more
typing.

also, in day to day work, i very often have to deal with html given to me by
others. i don't write html, our designers do.

having to translate the designers output into smalltalk is just busywork. and
having to update for changes even worse. it's just not practical.

finally though, i really like that you are using a REST api example. that's
right up my alley, and when i find some time i'll try to get this to run.

greetings, martin.

--
eKita                   -   the online platform for your entire academic life
--
chief engineer                                                       eKita.co
pike programmer      <a href="http://pike.lysator.liu.se" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">pike.lysator.liu.se    <a href="http://caudium.net" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">caudium.net     <a href="http://societyserver.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">societyserver.org
secretary                                                      <a href="http://beijinglug.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">beijinglug.org
mentor                                                           <a href="http://fossasia.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">fossasia.org
foresight developer  <a href="http://foresightlinux.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">foresightlinux.org                            <a href="http://realss.com" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">realss.com
unix sysadmin
Martin Bähr          working in china        <a href="http://societyserver.org/mbaehr/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík


Richard Eng wrote:

> It's very easy to insert raw HTML instead of using HTMLCanvas. For example,
>
> ||
> '#client-main'asJQuery append:
> '<form>
> <table>
> <tr><td>Username:</td><td><input name="name"></td></tr>
> <tr><td>Password:</td><td><input name="password" type="password"></td></tr>
> <tr><td><input type="submit" value="Okay"></td></tr>
> </table>
> </form>'
>
> I just thought it'd be nice to use Smalltalk to programmatically create
> the HTML. I used Seaside many years ago, so it's what I'm familiar with;
> in Seaside, there was no other way to use HTML (most web frameworks use
> HTML templates).
>
> In fact, for all future work, I'm inclined to inject raw HTML. It's much

IMNSHO, this is unhappy inclination. I very hope if not Web then at
least Silk allows you to use objects, not strings regularly. It has
different approach, maybe having simple methods returning array of
elements / a wrapped DocumentFragment could be seen as flexible enough
(while retaining objects all the way).

> more flexible than the programmatic approach and is much more natural
> for Amber (than it is for Pharo). However, I still need to solve the
> issue of
>
> (('#myForm1 *'asJQuery)filter:':input')
>
> crapping out on me when a false value causes a break from the loop.
>
>
> On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
>
>     Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>      > Thanks to Herby's (very extensive) proofreading and vetting, I've
>     made many
>      > substantial changes to the article, esp. the coding examples.
>     It's now
>      > ready for publishing and I've posted it at Reddit:
>      >
>      >
>     http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>
>
>
>     the article reads nicely, but i wonder, why the excursion on switch?
>     it is not
>     specific to amber, and it gives the impression that you feel the
>     need to
>     apologize for it.
>
>     this should be an aside linked to a separate post, if it's mentioned
>     at all.
>
>     what i would like to know is, if there is a way to not use smalltalk to
>     generate html, but just have it as plain raw html. the example you
>     give doesn't
>     demonstrate that the smalltalk variant is easier to read. on the
>     contrary.
>
>     i find plain html much nicer to read, and it even looks like
>     smalltalk is more
>     typing.
>
>     also, in day to day work, i very often have to deal with html given
>     to me by
>     others. i don't write html, our designers do.
>
>     having to translate the designers output into smalltalk is just
>     busywork. and
>     having to update for changes even worse. it's just not practical.
>
>     finally though, i really like that you are using a REST api example.
>     that's
>     right up my alley, and when i find some time i'll try to get this to
>     run.
>
>     greetings, martin.
>
>     --
>     eKita - the online platform for your entire academic life
>     --
>     chief engineer eKita.co
>     pike programmer pike.lysator.liu.se <http://pike.lysator.liu.se>
>     caudium.net <http://caudium.net> societyserver.org
>     <http://societyserver.org>
>     secretary beijinglug.org <http://beijinglug.org>
>     mentor fossasia.org <http://fossasia.org>
>     foresight developer foresightlinux.org <http://foresightlinux.org>
>     realss.com <http://realss.com>
>     unix sysadmin
>     Martin Bähr working in china http://societyserver.org/mbaehr/
>     <http://societyserver.org/mbaehr/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
In reply to this post by Bert Freudenberg-5
I like to use humour in my writings. If you look at my portfolio, I routinely do this...

https://medium.com/@richardeng/i-dont-speak-klingon-283c0d58f1da

https://medium.com/@richardeng/the-future-of-dart-is-dim-51756c0346f

https://medium.com/@richardeng/js-christ-im-using-js-1d1d0864d33e

https://medium.com/@richardeng/corolla-owners-too-timid-707fcf330822

https://medium.com/@richardeng/dart-is-dead-aedced9fd3d1

https://medium.com/@richardeng/fp-is-for-nerds-6ed1ca43bb34

And for the record, I am completely, utterly, and totally opposed to Political Correctness. (Nevertheless, in a professional setting, I do show restraint.)


On Thursday, 11 June 2015 10:35:19 UTC-4, Bert Freudenberg wrote:
On 11.06.2015, at 05:40, Richard Eng <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="77bDA8lKZFEJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">horrido...@...> wrote:

Thanks to Herby's (very extensive) proofreading and vetting, I've made many substantial changes to the article, esp. the coding examples. It's now ready for publishing and I've posted it at Reddit:

<a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/

It'll be interesting to see what kinds of comments I receive…

I’d appreciate if you did not use such an overtly sexist lead.

- Bert -



On Tuesday, 9 June 2015 12:52:24 UTC-4, Richard Eng wrote:
I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.

<a href="https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab" rel="nofollow" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fmedium.com%2F%40richardeng%2Fa-gentle-introduction-to-amber-8c532631e9ab\46sa\75D\46sntz\0751\46usg\75AFQjCNHlkQXPFdc2vMo6wJegKVixo9YOVQ';return true;">https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab

When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
In reply to this post by Herby Vojčík
I don't disagree with you, but as Martin pointed out, in a typical web application project, you are given HTML; you are not asked to write/generate HTML.

Nevertheless, in the next installment of the Amber tutorial, I will be examining Silk.


On Thursday, 11 June 2015 10:50:36 UTC-4, Herby wrote:


Richard Eng wrote:

> It's very easy to insert raw HTML instead of using HTMLCanvas. For example,
>
> ||
> '#client-main'asJQuery append:
> '<form>
> <table>
> <tr><td>Username:</td><td><input name="name"></td></tr>
> <tr><td>Password:</td><td><input name="password" type="password"></td></tr>
> <tr><td><input type="submit" value="Okay"></td></tr>
> </table>
> </form>'
>
> I just thought it'd be nice to use Smalltalk to programmatically create
> the HTML. I used Seaside many years ago, so it's what I'm familiar with;
> in Seaside, there was no other way to use HTML (most web frameworks use
> HTML templates).
>
> In fact, for all future work, I'm inclined to inject raw HTML. It's much

IMNSHO, this is unhappy inclination. I very hope if not Web then at
least Silk allows you to use objects, not strings regularly. It has
different approach, maybe having simple methods returning array of
elements / a wrapped DocumentFragment could be seen as flexible enough
(while retaining objects all the way).

> more flexible than the programmatic approach and is much more natural
> for Amber (than it is for Pharo). However, I still need to solve the
> issue of
>
> (('#myForm1 *'asJQuery)filter:':input')
>
> crapping out on me when a false value causes a break from the loop.
>
>
> On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
>
>     Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>      > Thanks to Herby's (very extensive) proofreading and vetting, I've
>     made many
>      > substantial changes to the article, esp. the coding examples.
>     It's now
>      > ready for publishing and I've posted it at Reddit:
>      >
>      >
>     <a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <<a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>
>
>
>     the article reads nicely, but i wonder, why the excursion on switch?
>     it is not
>     specific to amber, and it gives the impression that you feel the
>     need to
>     apologize for it.
>
>     this should be an aside linked to a separate post, if it's mentioned
>     at all.
>
>     what i would like to know is, if there is a way to not use smalltalk to
>     generate html, but just have it as plain raw html. the example you
>     give doesn't
>     demonstrate that the smalltalk variant is easier to read. on the
>     contrary.
>
>     i find plain html much nicer to read, and it even looks like
>     smalltalk is more
>     typing.
>
>     also, in day to day work, i very often have to deal with html given
>     to me by
>     others. i don't write html, our designers do.
>
>     having to translate the designers output into smalltalk is just
>     busywork. and
>     having to update for changes even worse. it's just not practical.
>
>     finally though, i really like that you are using a REST api example.
>     that's
>     right up my alley, and when i find some time i'll try to get this to
>     run.
>
>     greetings, martin.
>
>     --
>     eKita - the online platform for your entire academic life
>     --
>     chief engineer eKita.co
>     pike programmer <a href="http://pike.lysator.liu.se" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">pike.lysator.liu.se <<a href="http://pike.lysator.liu.se" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">http://pike.lysator.liu.se>
>     <a href="http://caudium.net" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">caudium.net <<a href="http://caudium.net" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">http://caudium.net> <a href="http://societyserver.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">societyserver.org
>     <<a href="http://societyserver.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">http://societyserver.org>
>     secretary <a href="http://beijinglug.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">beijinglug.org <<a href="http://beijinglug.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">http://beijinglug.org>
>     mentor <a href="http://fossasia.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">fossasia.org <<a href="http://fossasia.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">http://fossasia.org>
>     foresight developer <a href="http://foresightlinux.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">foresightlinux.org <<a href="http://foresightlinux.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">http://foresightlinux.org>
>     <a href="http://realss.com" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">realss.com <<a href="http://realss.com" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">http://realss.com>
>     unix sysadmin
>     Martin Bähr working in china <a href="http://societyserver.org/mbaehr/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/
>     <<a href="http://societyserver.org/mbaehr/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="f3nTEZ9A1DUJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">amber-lang+...@googlegroups.com
> <mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="f3nTEZ9A1DUJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">amber-lang+unsubscribe@...>.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Bert Freudenberg
In reply to this post by Herby Vojčík

> On 11.06.2015, at 16:36, Herby Vojčík <[hidden email]> wrote:
>
>
>
> Bert Freudenberg wrote:
>> On 11.06.2015, at 05:40, Richard Eng <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>>
>>> Thanks to Herby's (very extensive) proofreading and vetting, I've made
>>> many substantial changes to the article, esp. the coding examples.
>>> It's now ready for publishing and I've posted it at Reddit:
>>>
>>> http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>>>
>>> It'll be interesting to see what kinds of comments I receive…
>>
>> I’d appreciate if you did not use such an overtly sexist lead.
>
> I'd appreciate in political correctness went to hell.
It’s not about PC but about not being embarrassed when pointing someone to that otherwise nice article.

- Bert -



--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík
In reply to this post by horrido


Richard Eng wrote:

> I don't disagree with you, but as Martin pointed out, in a typical web
> application project, you are *given* HTML; you are not asked to
> write/generate HTML.
>
> Nevertheless, in the next installment of the Amber tutorial, I *will* be
> examining Silk.
>
>
> On Thursday, 11 June 2015 10:50:36 UTC-4, Herby wrote:
>
>
>
>     Richard Eng wrote:
>      > It's very easy to insert raw HTML instead of using HTMLCanvas.
>     For example,
>      >
>      > ||
>      > '#client-main'asJQuery append:
>      > '<form>
>      > <table>
>      > <tr><td>Username:</td><td><input name="name"></td></tr>
>      > <tr><td>Password:</td><td><input name="password"
>     type="password"></td></tr>
>      > <tr><td><input type="submit" value="Okay"></td></tr>
>      > </table>
>      > </form>'

Just in case, above thing could probably written this way in Silk:

   '#client-main' asSilk
     FORM
       TABLE
         TR: {
           Silk TD: 'Username:'.
           Silk TD INPUT: 'name'->'name' };
         TR: {
           Silk TD: 'Password'.
           Silk TD INPUT: { 'name'->'password'. 'type'->'password' }};
         TR: {
           Silk TD INPUT: { 'type'->'submit'. 'value'->'Okay' }

Of course, it could be written other ways, too, as it is pretty flexible
in ways how to insert content into an element. This piece uses `TAG:
content` convenient method heavily.

(uppercase needed, as DNU is used to generate tags from any uppercase
message, so you can insert you custom tags as well)

>      >
>      > I just thought it'd be nice to use Smalltalk to programmatically
>     create
>      > the HTML. I used Seaside many years ago, so it's what I'm
>     familiar with;
>      > in Seaside, there was no other way to use HTML (most web
>     frameworks use
>      > HTML templates).
>      >
>      > In fact, for all future work, I'm inclined to inject raw HTML.
>     It's much
>
>     IMNSHO, this is unhappy inclination. I very hope if not Web then at
>     least Silk allows you to use objects, not strings regularly. It has
>     different approach, maybe having simple methods returning array of
>     elements / a wrapped DocumentFragment could be seen as flexible enough
>     (while retaining objects all the way).
>
>      > more flexible than the programmatic approach and is much more
>     natural
>      > for Amber (than it is for Pharo). However, I still need to solve the
>      > issue of
>      >
>      > (('#myForm1 *'asJQuery)filter:':input')
>      >
>      > crapping out on me when a false value causes a break from the loop.
>      >
>      >
>      > On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
>      >
>      > Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>      > > Thanks to Herby's (very extensive) proofreading and vetting, I've
>      > made many
>      > > substantial changes to the article, esp. the coding examples.
>      > It's now
>      > > ready for publishing and I've posted it at Reddit:
>      > >
>      > >
>      >
>     http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>
>
>      >
>     <http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>>
>
>      >
>      >
>      > the article reads nicely, but i wonder, why the excursion on switch?
>      > it is not
>      > specific to amber, and it gives the impression that you feel the
>      > need to
>      > apologize for it.
>      >
>      > this should be an aside linked to a separate post, if it's mentioned
>      > at all.
>      >
>      > what i would like to know is, if there is a way to not use
>     smalltalk to
>      > generate html, but just have it as plain raw html. the example you
>      > give doesn't
>      > demonstrate that the smalltalk variant is easier to read. on the
>      > contrary.
>      >
>      > i find plain html much nicer to read, and it even looks like
>      > smalltalk is more
>      > typing.
>      >
>      > also, in day to day work, i very often have to deal with html given
>      > to me by
>      > others. i don't write html, our designers do.
>      >
>      > having to translate the designers output into smalltalk is just
>      > busywork. and
>      > having to update for changes even worse. it's just not practical.
>      >
>      > finally though, i really like that you are using a REST api example.
>      > that's
>      > right up my alley, and when i find some time i'll try to get this to
>      > run.
>      >
>      > greetings, martin.
>      >
>      > --
>      > eKita - the online platform for your entire academic life
>      > --
>      > chief engineer eKita.co
>      > pike programmer pike.lysator.liu.se <http://pike.lysator.liu.se>
>     <http://pike.lysator.liu.se>
>      > caudium.net <http://caudium.net> <http://caudium.net>
>     societyserver.org <http://societyserver.org>
>      > <http://societyserver.org>
>      > secretary beijinglug.org <http://beijinglug.org>
>     <http://beijinglug.org>
>      > mentor fossasia.org <http://fossasia.org> <http://fossasia.org>
>      > foresight developer foresightlinux.org
>     <http://foresightlinux.org> <http://foresightlinux.org>
>      > realss.com <http://realss.com> <http://realss.com>
>      > unix sysadmin
>      > Martin Bähr working in china http://societyserver.org/mbaehr/
>     <http://societyserver.org/mbaehr/>
>      > <http://societyserver.org/mbaehr/
>     <http://societyserver.org/mbaehr/>>
>      >
>      > --
>      > You received this message because you are subscribed to the Google
>      > Groups "amber-lang" group.
>      > To unsubscribe from this group and stop receiving emails from it,
>     send
>      > an email to [hidden email] <javascript:>
>      > <mailto:[hidden email] <javascript:>>.
>      > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
In reply to this post by horrido
I'm looking into how you'd use raw HTML in Amber. I have this code:

'#client-main' asJQuery append: '
<form id="myForm1">
<table>
<tr><td>Username:</td><td><input type="email"></td></tr>
<tr><td>Password:</td><td><input type="password"></td></tr>
<tr><td>Remember me:</td><td><input type="checkbox"></td></tr>
<tr><td>Sex:</td><td>Male <input name="Sex" type="radio"></td>
 <td>Female <input name="Sex" type="radio"></td></tr>
<tr><td>Comment:</td><td><textarea>The rain in Spain</textarea></td></tr>
<tr><td>Country:</td><td><select>
<option value="China">Chung Kuo</option>
<option value="Canada">North Land</option>
<option value="Japan">Samurai World</option>
<option value="United States">Imperialists</option>
<option value="Iraq">Broken State</option>
<option value="Brazil">Sexy Land</option>
</select>
</td></tr>
</table>
<input type="submit" onclick="collectValues()">
</form>'

But I don't know how to call my method #collectValues on submission, i.e., on click.


On Thursday, 11 June 2015 10:55:31 UTC-4, Richard Eng wrote:
I don't disagree with you, but as Martin pointed out, in a typical web application project, you are given HTML; you are not asked to write/generate HTML.

Nevertheless, in the next installment of the Amber tutorial, I will be examining Silk.


On Thursday, 11 June 2015 10:50:36 UTC-4, Herby wrote:


Richard Eng wrote:

> It's very easy to insert raw HTML instead of using HTMLCanvas. For example,
>
> ||
> '#client-main'asJQuery append:
> '<form>
> <table>
> <tr><td>Username:</td><td><input name="name"></td></tr>
> <tr><td>Password:</td><td><input name="password" type="password"></td></tr>
> <tr><td><input type="submit" value="Okay"></td></tr>
> </table>
> </form>'
>
> I just thought it'd be nice to use Smalltalk to programmatically create
> the HTML. I used Seaside many years ago, so it's what I'm familiar with;
> in Seaside, there was no other way to use HTML (most web frameworks use
> HTML templates).
>
> In fact, for all future work, I'm inclined to inject raw HTML. It's much

IMNSHO, this is unhappy inclination. I very hope if not Web then at
least Silk allows you to use objects, not strings regularly. It has
different approach, maybe having simple methods returning array of
elements / a wrapped DocumentFragment could be seen as flexible enough
(while retaining objects all the way).

> more flexible than the programmatic approach and is much more natural
> for Amber (than it is for Pharo). However, I still need to solve the
> issue of
>
> (('#myForm1 *'asJQuery)filter:':input')
>
> crapping out on me when a false value causes a break from the loop.
>
>
> On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
>
>     Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>      > Thanks to Herby's (very extensive) proofreading and vetting, I've
>     made many
>      > substantial changes to the article, esp. the coding examples.
>     It's now
>      > ready for publishing and I've posted it at Reddit:
>      >
>      >
>     <a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <<a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>
>
>
>     the article reads nicely, but i wonder, why the excursion on switch?
>     it is not
>     specific to amber, and it gives the impression that you feel the
>     need to
>     apologize for it.
>
>     this should be an aside linked to a separate post, if it's mentioned
>     at all.
>
>     what i would like to know is, if there is a way to not use smalltalk to
>     generate html, but just have it as plain raw html. the example you
>     give doesn't
>     demonstrate that the smalltalk variant is easier to read. on the
>     contrary.
>
>     i find plain html much nicer to read, and it even looks like
>     smalltalk is more
>     typing.
>
>     also, in day to day work, i very often have to deal with html given
>     to me by
>     others. i don't write html, our designers do.
>
>     having to translate the designers output into smalltalk is just
>     busywork. and
>     having to update for changes even worse. it's just not practical.
>
>     finally though, i really like that you are using a REST api example.
>     that's
>     right up my alley, and when i find some time i'll try to get this to
>     run.
>
>     greetings, martin.
>
>     --
>     eKita - the online platform for your entire academic life
>     --
>     chief engineer eKita.co
>     pike programmer <a href="http://pike.lysator.liu.se" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">pike.lysator.liu.se <<a href="http://pike.lysator.liu.se" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">http://pike.lysator.liu.se>
>     <a href="http://caudium.net" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">caudium.net <<a href="http://caudium.net" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">http://caudium.net> <a href="http://societyserver.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">societyserver.org
>     <<a href="http://societyserver.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">http://societyserver.org>
>     secretary <a href="http://beijinglug.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">beijinglug.org <<a href="http://beijinglug.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">http://beijinglug.org>
>     mentor <a href="http://fossasia.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">fossasia.org <<a href="http://fossasia.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">http://fossasia.org>
>     foresight developer <a href="http://foresightlinux.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">foresightlinux.org <<a href="http://foresightlinux.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">http://foresightlinux.org>
>     <a href="http://realss.com" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">realss.com <<a href="http://realss.com" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">http://realss.com>
>     unix sysadmin
>     Martin Bähr working in china <a href="http://societyserver.org/mbaehr/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/
>     <<a href="http://societyserver.org/mbaehr/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to amber-lang+...@googlegroups.com
> <mailto:amber-lang+[hidden email]>.
> For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

horrido
I'm going to answer my own question...


DON'T DO THIS!


The purpose of using Amber to write a web application is to do it in OOP fashion. When a web designer gives you HTML/CSS, it is for the purpose of laying out and styling the webpage. You don't need to monkey around with it (much).

However, forms should be treated in OOP fashion within your application. To this end, forms should be translated into Amber classes. This is exactly what I've demonstrated in my Amber tutorial.

There is no conceivable reason to try what I did below. It's not amenable to OOP. It's messy. It does, however, require you to think algorithmically when translating HTML to Amber, i.e., how to generate HTML may require a good deal more forethought. In my tutorial, I decided to lay out the form in tabular fashion. I then realized that I was constrained to place each form input on its own row because of my algorithm. This was a problem in the case of radio buttons where I wanted the buttons to be arranged horizontally, not vertically. I would need to rethink the algorithm.


On Thursday, 11 June 2015 14:58:42 UTC-4, Richard Eng wrote:
I'm looking into how you'd use raw HTML in Amber. I have this code:

'#client-main' asJQuery append: '
<form id="myForm1">
<table>
<tr><td>Username:</td><td><input type="email"></td></tr>
<tr><td>Password:</td><td><input type="password"></td></tr>
<tr><td>Remember me:</td><td><input type="checkbox"></td></tr>
<tr><td>Sex:</td><td>Male <input name="Sex" type="radio"></td>
 <td>Female <input name="Sex" type="radio"></td></tr>
<tr><td>Comment:</td><td><textarea>The rain in Spain</textarea></td></tr>
<tr><td>Country:</td><td><select>
<option value="China">Chung Kuo</option>
<option value="Canada">North Land</option>
<option value="Japan">Samurai World</option>
<option value="United States">Imperialists</option>
<option value="Iraq">Broken State</option>
<option value="Brazil">Sexy Land</option>
</select>
</td></tr>
</table>
<input type="submit" onclick="collectValues()">
</form>'

But I don't know how to call my method #collectValues on submission, i.e., on click.


On Thursday, 11 June 2015 10:55:31 UTC-4, Richard Eng wrote:
I don't disagree with you, but as Martin pointed out, in a typical web application project, you are given HTML; you are not asked to write/generate HTML.

Nevertheless, in the next installment of the Amber tutorial, I will be examining Silk.


On Thursday, 11 June 2015 10:50:36 UTC-4, Herby wrote:


Richard Eng wrote:

> It's very easy to insert raw HTML instead of using HTMLCanvas. For example,
>
> ||
> '#client-main'asJQuery append:
> '<form>
> <table>
> <tr><td>Username:</td><td><input name="name"></td></tr>
> <tr><td>Password:</td><td><input name="password" type="password"></td></tr>
> <tr><td><input type="submit" value="Okay"></td></tr>
> </table>
> </form>'
>
> I just thought it'd be nice to use Smalltalk to programmatically create
> the HTML. I used Seaside many years ago, so it's what I'm familiar with;
> in Seaside, there was no other way to use HTML (most web frameworks use
> HTML templates).
>
> In fact, for all future work, I'm inclined to inject raw HTML. It's much

IMNSHO, this is unhappy inclination. I very hope if not Web then at
least Silk allows you to use objects, not strings regularly. It has
different approach, maybe having simple methods returning array of
elements / a wrapped DocumentFragment could be seen as flexible enough
(while retaining objects all the way).

> more flexible than the programmatic approach and is much more natural
> for Amber (than it is for Pharo). However, I still need to solve the
> issue of
>
> (('#myForm1 *'asJQuery)filter:':input')
>
> crapping out on me when a false value causes a break from the loop.
>
>
> On Thursday, 11 June 2015 01:24:27 UTC-4, Martin Bähr wrote:
>
>     Excerpts from Richard Eng's message of 2015-06-11 05:40:09 +0200:
>      > Thanks to Herby's (very extensive) proofreading and vetting, I've
>     made many
>      > substantial changes to the article, esp. the coding examples.
>     It's now
>      > ready for publishing and I've posted it at Reddit:
>      >
>      >
>     <a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/
>     <<a href="http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F39e5cq%2Fa_gentle_introduction_to_amber%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzIh-l4QOfHChMALF2ZVYKWViSaw';return true;">http://www.reddit.com/r/programming/comments/39e5cq/a_gentle_introduction_to_amber/>
>
>
>     the article reads nicely, but i wonder, why the excursion on switch?
>     it is not
>     specific to amber, and it gives the impression that you feel the
>     need to
>     apologize for it.
>
>     this should be an aside linked to a separate post, if it's mentioned
>     at all.
>
>     what i would like to know is, if there is a way to not use smalltalk to
>     generate html, but just have it as plain raw html. the example you
>     give doesn't
>     demonstrate that the smalltalk variant is easier to read. on the
>     contrary.
>
>     i find plain html much nicer to read, and it even looks like
>     smalltalk is more
>     typing.
>
>     also, in day to day work, i very often have to deal with html given
>     to me by
>     others. i don't write html, our designers do.
>
>     having to translate the designers output into smalltalk is just
>     busywork. and
>     having to update for changes even worse. it's just not practical.
>
>     finally though, i really like that you are using a REST api example.
>     that's
>     right up my alley, and when i find some time i'll try to get this to
>     run.
>
>     greetings, martin.
>
>     --
>     eKita - the online platform for your entire academic life
>     --
>     chief engineer eKita.co
>     pike programmer <a href="http://pike.lysator.liu.se" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">pike.lysator.liu.se <<a href="http://pike.lysator.liu.se" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpike.lysator.liu.se\46sa\75D\46sntz\0751\46usg\75AFQjCNEvQ03oa3TB9z8nTXi-CkmrjqorFA';return true;">http://pike.lysator.liu.se>
>     <a href="http://caudium.net" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">caudium.net <<a href="http://caudium.net" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fcaudium.net\46sa\75D\46sntz\0751\46usg\75AFQjCNEYzslt9t1j0dGxb_Ka8faLOGHwqQ';return true;">http://caudium.net> <a href="http://societyserver.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">societyserver.org
>     <<a href="http://societyserver.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org\46sa\75D\46sntz\0751\46usg\75AFQjCNE_5aJ_mdZkvSrOv1cEqLp4WlWhag';return true;">http://societyserver.org>
>     secretary <a href="http://beijinglug.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">beijinglug.org <<a href="http://beijinglug.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fbeijinglug.org\46sa\75D\46sntz\0751\46usg\75AFQjCNGcMonCqhzNZNa3GwWBKaTiTm8E4Q';return true;">http://beijinglug.org>
>     mentor <a href="http://fossasia.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">fossasia.org <<a href="http://fossasia.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffossasia.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFMwaBnF0Iu9Prg3-iLxZ5BhKSD_g';return true;">http://fossasia.org>
>     foresight developer <a href="http://foresightlinux.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">foresightlinux.org <<a href="http://foresightlinux.org" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fforesightlinux.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHaJ9_Y9lcY21yw_D2lZAE3mu_Jtg';return true;">http://foresightlinux.org>
>     <a href="http://realss.com" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">realss.com <<a href="http://realss.com" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frealss.com\46sa\75D\46sntz\0751\46usg\75AFQjCNFHih6WMCaKD68bQT72_Uh4uQD5eQ';return true;">http://realss.com>
>     unix sysadmin
>     Martin Bähr working in china <a href="http://societyserver.org/mbaehr/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/
>     <<a href="http://societyserver.org/mbaehr/" rel="nofollow" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsocietyserver.org%2Fmbaehr%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFHqg9eOMnanxXjpobL7Vb80JtF5g';return true;">http://societyserver.org/mbaehr/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to amber-lang+...@googlegroups.com
> <mailto:amber-lang+[hidden email]>.
> For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík


Richard Eng wrote:

> However, forms should be treated in OOP fashion within your application.
> To this end, forms should be translated into Amber classes. This is
> *exactly* what I've demonstrated in my Amber tutorial.
>
> There is no conceivable reason to try what I did below. It's not
> amenable to OOP. It's messy. It does, however, require you to think
> algorithmically when translating HTML to Amber, i.e., how to generate
> HTML may require a good deal more forethought. In my tutorial, I decided
> to lay out the form in tabular fashion. I then realized that I was
> constrained to place each form input on its own row because of my
> algorithm. This was a problem in the case of radio buttons where I
> wanted the buttons to be arranged horizontally, not vertically. I would
> need to rethink the algorithm.

This is why I originally suggested (maybe too densely so it wasn't
understood) to not try to inject too many data structures into the pack,
but instead to implement the whole form as a single black box, that
means, rendering it raw (in an Amber sense of raw, eg. in one or a
handful of render methods), and retrieve data in similar
one-method-that-may-call-a-few-helpers fashion (similarly to what jQuery
.serializeArray() can produce for you).

Only then, when you see similar patterns out there, in the rendering
methods, to extract similarities. IOW, the reverse design approach: do
not analyze and think the design up-front (and then trying to fit
incompatible changes in), but write the working low-level bulk, then
drive then design by refactoring it by spotting patterns.

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Mir S.
In reply to this post by horrido
I was trying out the guide and I encountered this: 

Variable shadowing error: html is already defined 

when trying to SaveIt after creating the class FormExample when I try to save the initialize method:
initialize
formValues := Dictionary new.
formInputs := Array new.
inputFactories := #{
'Username' -> [ :html :name :type |
html input name: name;
type: type;
at: 'required' put: 'required';
yourself].
'Password' -> [ :html :name :type |
html input name: name;
type: type;
at: 'required' put: 'required';
yourself].
'SexLabel' -> []. "just show the label"
"the following three radio buttons belong in the group
named 'Sex'..."
'Male' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
at: 'checked' put: 'checked';
yourself].
'Female' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
yourself].
'Yes' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
yourself].
'Comment' -> [ :html :name :type |
html textarea name: name;
yourself].
'Country' -> [ :html :name :type |
html select name: name;
with: [self countryOptions: html];
yourself].
'_default' -> [ :html :name :type |
html input name: name;
type: type;
yourself]
}.
extractionRecipes := #{
'RememberMe' -> [ :input |
input asJQuery prop: 'checked'].
'Male' -> [ :input |
input asJQuery prop: 'checked'].
'Female' -> [ :input |
input asJQuery prop: 'checked'].
'Yes' -> [ :input |
input asJQuery prop: 'checked'].
'_default' -> [ :input |
input asJQuery val]
}


Pe 9 iun. 2015, la 19:52, Richard Eng <[hidden email]> a scris:

I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.


When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Herby Vojčík
Yes, you can use two same local names in a method. So if you write many blocks, each of them must call their arguments differently. I know it is annoying, but it helped to finish the compiler when it was rewritten few years ago.

In fact, it would be nice thing to fix it (though probably hard one).

Mircea Samoilă wrote:

> I was trying out the guide and I encountered this:
>
> Variable shadowing error: html is already defined
>
> when trying to SaveIt after creating the class FormExample when I try
> to save the initialize method:
> initialize
>      formValues := Dictionary new.
>      formInputs := Array new.
>      inputFactories := #{
>          'Username' ->  [ :html :name :type |
>              html input name: name;
>                         type: type;
>                         at: 'required' put: 'required';
>                         yourself].
>          'Password' ->  [ :html :name :type |
>              html input name: name;
>                         type: type
;

>                         at: 'required' put: 'required';
>                         yourself].
>          'SexLabel' ->  []. "just show the label"
>          "the following three radio buttons belong in the group
>           named 'Sex'..."
>          'Male' ->  [ :html :name :type |
>              html input name: 'Sex';
>                         value: name;
>                         type: type;
>                         at: 'checked' put: 'checked';
>                         yourself].
>          'Female' ->  [ :html :name :type |
>              html input name: 'Sex';
>                         value: name;
>                         type: type;
>                         yourself].
>          'Yes' ->  [ :html :name :type |
>              html input name: 'Sex';
>                         value: name;
>                         type: type;
>                         yourself].
>          'Comment' ->  [ :html :name :type |
>              html textarea name: name;
>          
                  yourself].

>          'Country' ->  [ :html :name :type |
>              html select name: name;
>                          with: [self countryOptions: html];
>                          yourself].
>          '_default' ->  [ :html :name :type |
>              html input name: name;
>                         type: type;
>                         yourself]
>          }.
>      extractionRecipes := #{
>          'RememberMe' ->  [ :input |
>              input asJQuery prop: 'checked'].
>          'Male' ->  [ :input |
>              input asJQuery prop: 'checked'].
>          'Female' ->  [ :input |
>              input asJQuery prop: 'checked'].
>          'Yes' ->  [ :input |
>              input asJQuery prop: 'checked'].
>          '_default' ->  [ :input |
>              input asJQuery val]
>          }
>
>
> Pe 9 iun. 2015, la 19:52, Richard Eng <[hidden email]
> <mailto:[hidden email]>> a scris:
>
>> I just completed my first Ambe
r tutorial article for *Medium*. It is

>> part of my Smalltalk Renaissance advocacy campaign. I've published it
>> for review purposes; over the next several days, I'll make small
>> edits based on feedback.
>>
>> https://medium.com/@richardeng/a-gentle-introduction-to-amber-8c532631e9ab
>>
>> When I know it's good and ready, I'll submit it to Reddit and other
>> social media sites. Hopefully, this will generate interest in Amber
>> (in particular) and Smalltalk (in general).
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "amber-lang" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to [hidden email]
>> <mailto:[hidden email]>.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and st
op receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: A Gentle Introduction to Amber

Mir S.
In reply to this post by Mir S.
Hmm, it seems I inexplicably added an 'html' instance variable to the FormExample class declaration. 

My bad!

Pe 12 iun. 2015, la 21:15, Mircea Samoilă <[hidden email]> a scris:

I was trying out the guide and I encountered this: 

Variable shadowing error: html is already defined 

when trying to SaveIt after creating the class FormExample when I try to save the initialize method:
initialize
formValues := Dictionary new.
formInputs := Array new.
inputFactories := #{
'Username' -> [ :html :name :type |
html input name: name;
type: type;
at: 'required' put: 'required';
yourself].
'Password' -> [ :html :name :type |
html input name: name;
type: type;
at: 'required' put: 'required';
yourself].
'SexLabel' -> []. "just show the label"
"the following three radio buttons belong in the group
named 'Sex'..."
'Male' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
at: 'checked' put: 'checked';
yourself].
'Female' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
yourself].
'Yes' -> [ :html :name :type |
html input name: 'Sex';
value: name;
type: type;
yourself].
'Comment' -> [ :html :name :type |
html textarea name: name;
yourself].
'Country' -> [ :html :name :type |
html select name: name;
with: [self countryOptions: html];
yourself].
'_default' -> [ :html :name :type |
html input name: name;
type: type;
yourself]
}.
extractionRecipes := #{
'RememberMe' -> [ :input |
input asJQuery prop: 'checked'].
'Male' -> [ :input |
input asJQuery prop: 'checked'].
'Female' -> [ :input |
input asJQuery prop: 'checked'].
'Yes' -> [ :input |
input asJQuery prop: 'checked'].
'_default' -> [ :input |
input asJQuery val]
}


Pe 9 iun. 2015, la 19:52, Richard Eng <[hidden email]> a scris:

I just completed my first Amber tutorial article for Medium. It is part of my Smalltalk Renaissance advocacy campaign. I've published it for review purposes; over the next several days, I'll make small edits based on feedback.


When I know it's good and ready, I'll submit it to Reddit and other social media sites. Hopefully, this will generate interest in Amber (in particular) and Smalltalk (in general).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
1234