From alex at pivotallabs.com Fri Apr 11 13:43:26 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Fri, 11 Apr 2008 10:43:26 -0700 Subject: [Erector-devel] Erector Motivation Message-ID: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> I just added this to the readme. I'd like to make it a full-fledged blog post etc. Please comment or correct. MOTIVATION Why use Erector? This section will soon become a real essay or blog post, but briefly: * Markaby-style DOM Domain language * Your views are real classes, written in a real language, allowing * Functional decomposition * Inheritance * Composition, not partials * Well-defined semantics for variables, loops, blocks * Dependency injection via constructor params * As little magic as possible (e.g. no automagic copying of "assigns" variable from your controller) * yield works again * Testability * form_for ERB code is craaaaazy (not to mention the quagmire of options vs. htmloptions) * Output is streamed, improving performance over string copy From alex at pivotallabs.com Fri Apr 11 18:10:19 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Fri, 11 Apr 2008 15:10:19 -0700 Subject: [Erector-devel] Erector Motivation In-Reply-To: <20080411220329.86761241F4@panix5.panix.com> References: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> <20080411220329.86761241F4@panix5.panix.com> Message-ID: <7a93bd340804111510g313fd15ev3a1faa81998103e1@mail.gmail.com> On Fri, Apr 11, 2008 at 3:03 PM, Jim Kingdon wrote: > > * yield works again > > Can you elaborate on this? In Markaby you couldn't use yield in functions because of the instance_eval magic. Which led to bothers like using "capture" all over the place instead of the more natural yield. > > * Output is streamed, improving performance over string copy > > Do we have any benchmark data to point people to? > > Streamed output _could_ have lower performance than string > manipulation (if it leads to more system calls, for example), but I'm > just making this up, and real data would be really nice here. No, but both benchmarking and performance tuning are on our todo list. > > > * form_for ERB code is craaaaazy > > This could also use some elaboration. Is this also our stance on > link_to and the other methods in ActionView::Helpers::UrlHelper ? One > of the questions at my Erector talk last night at DCRUG was "how do I > call link_to without all that controller/view incest"? I said that > the project I used erector on was reimplementing such things, but > didn't try to say whether that was the only/best way. We have a story in the Erector Tracker about getting our story straight around Rails helpers. Without going into too much detail here, we want to make a good transition; whether that involves hacking a wrapper for the ERB stream or just reimplementing the helpers in Erector is an open question. > I also don't know whether to mention the whole thing about "it is > easier to take an HTML markup from my graphic designer and add code > with ERB". That was a frequent question at my talk (and I had tons of > answers, many of which people seemed to be buying). But I'm not sure > it is as well-suited to discussing in writing as the more technical > aspects. I am happy to rant about this, which may prove your point, but it needs to be done. There's a little teeny rant in a comment at http://blabs.pivotallabs.com/users/alex/blog/articles/273-lovely-demeter-meter-maid "By the way, this deserves to be the subject of another blog post, but I have yet to meet this hypothetical web page designer who is smart enough to understand CSS, modular decomposition via partials, embedded scripts and variables, and JavaScript, but is unable to learn how to edit source code that uses print statements or do blocks instead of angle brackets." -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com From brian at pivotallabs.com Fri Apr 11 18:19:05 2008 From: brian at pivotallabs.com (Brian Takita) Date: Fri, 11 Apr 2008 15:19:05 -0700 Subject: [Erector-devel] Erector Motivation In-Reply-To: <7a93bd340804111510g313fd15ev3a1faa81998103e1@mail.gmail.com> References: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> <20080411220329.86761241F4@panix5.panix.com> <7a93bd340804111510g313fd15ev3a1faa81998103e1@mail.gmail.com> Message-ID: <1d7ddd110804111519x7f57d169xaa70f876eb5c050c@mail.gmail.com> On Fri, Apr 11, 2008 at 3:10 PM, Alex Chaffee wrote: > On Fri, Apr 11, 2008 at 3:03 PM, Jim Kingdon wrote: > > > * yield works again > > > > Can you elaborate on this? > > In Markaby you couldn't use yield in functions because of the > instance_eval magic. Which led to bothers like using "capture" all > over the place instead of the more natural yield. > > > > > * Output is streamed, improving performance over string copy > > > > Do we have any benchmark data to point people to? > > > > Streamed output _could_ have lower performance than string > > manipulation (if it leads to more system calls, for example), but I'm > > just making this up, and real data would be really nice here. > > No, but both benchmarking and performance tuning are on our todo list. > > > > > > > * form_for ERB code is craaaaazy > > > > This could also use some elaboration. Is this also our stance on > > link_to and the other methods in ActionView::Helpers::UrlHelper ? One > > of the questions at my Erector talk last night at DCRUG was "how do I > > call link_to without all that controller/view incest"? I said that > > the project I used erector on was reimplementing such things, but > > didn't try to say whether that was the only/best way. > > We have a story in the Erector Tracker about getting our story > straight around Rails helpers. Without going into too much detail > here, we want to make a good transition; whether that involves hacking > a wrapper for the ERB stream or just reimplementing the helpers in > Erector is an open question. > > > > > I also don't know whether to mention the whole thing about "it is > > easier to take an HTML markup from my graphic designer and add code > > with ERB". That was a frequent question at my talk (and I had tons of > > answers, many of which people seemed to be buying). But I'm not sure > > it is as well-suited to discussing in writing as the more technical > > aspects. > > I am happy to rant about this, which may prove your point, but it > needs to be done. There's a little teeny rant in a comment at > > http://blabs.pivotallabs.com/users/alex/blog/articles/273-lovely-demeter-meter-maid > > "By the way, this deserves to be the subject of another blog post, but > I have yet to meet this hypothetical web page designer who is smart > enough to understand CSS, modular decomposition via partials, embedded > scripts and variables, and JavaScript, but is unable to learn how to > edit source code that uses print statements or do blocks instead of > angle brackets." Its a myth thats been propagated since PHP first started and something that people like to cling to. You can expect some angry comments. > > > > > -- > Alex Chaffee - Pivotal Labs > alex at PivotalLabs.com > From kingdon at panix.com Fri Apr 11 18:03:29 2008 From: kingdon at panix.com (Jim Kingdon) Date: Fri, 11 Apr 2008 18:03:29 -0400 (EDT) Subject: [Erector-devel] Erector Motivation In-Reply-To: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> Message-ID: <20080411220329.86761241F4@panix5.panix.com> > * yield works again Can you elaborate on this? > * Output is streamed, improving performance over string copy Do we have any benchmark data to point people to? Streamed output _could_ have lower performance than string manipulation (if it leads to more system calls, for example), but I'm just making this up, and real data would be really nice here. > * form_for ERB code is craaaaazy This could also use some elaboration. Is this also our stance on link_to and the other methods in ActionView::Helpers::UrlHelper ? One of the questions at my Erector talk last night at DCRUG was "how do I call link_to without all that controller/view incest"? I said that the project I used erector on was reimplementing such things, but didn't try to say whether that was the only/best way. I also don't know whether to mention the whole thing about "it is easier to take an HTML markup from my graphic designer and add code with ERB". That was a frequent question at my talk (and I had tons of answers, many of which people seemed to be buying). But I'm not sure it is as well-suited to discussing in writing as the more technical aspects. From alex at pivotallabs.com Fri Apr 11 18:30:16 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Fri, 11 Apr 2008 15:30:16 -0700 Subject: [Erector-devel] Erector Motivation In-Reply-To: <1d7ddd110804111519x7f57d169xaa70f876eb5c050c@mail.gmail.com> References: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> <20080411220329.86761241F4@panix5.panix.com> <7a93bd340804111510g313fd15ev3a1faa81998103e1@mail.gmail.com> <1d7ddd110804111519x7f57d169xaa70f876eb5c050c@mail.gmail.com> Message-ID: <7a93bd340804111530v5ba99e0am58872c4ea37f9025@mail.gmail.com> > > > I also don't know whether to mention the whole thing about "it is > > > easier to take an HTML markup from my graphic designer and add code > > > with ERB". That was a frequent question at my talk (and I had tons of > > > answers, many of which people seemed to be buying). But I'm not sure > > > it is as well-suited to discussing in writing as the more technical > > > aspects. > > > > I am happy to rant about this, which may prove your point, but it > > needs to be done. There's a little teeny rant in a comment at > > > > http://blabs.pivotallabs.com/users/alex/blog/articles/273-lovely-demeter-meter-maid > > > > "By the way, this deserves to be the subject of another blog post, but > > I have yet to meet this hypothetical web page designer who is smart > > enough to understand CSS, modular decomposition via partials, embedded > > scripts and variables, and JavaScript, but is unable to learn how to > > edit source code that uses print statements or do blocks instead of > > angle brackets." > Its a myth thats been propagated since PHP first started and something > that people like to cling to. You can expect some angry comments. Brian and I just decided we have to write a real blog post about this, and offer a $100 prize if anyone can produce such a designer. And maybe another C-note if they can show an example of a developer taking a mockup HTML file and merely lightly sprinkling a few scriptlets in it, as opposed to ripping it to shreds and/or reimplementing it from scratch. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com From kingdon at panix.com Sat Apr 12 13:52:51 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sat, 12 Apr 2008 13:52:51 -0400 (EDT) Subject: [Erector-devel] Erector Motivation In-Reply-To: <7a93bd340804111530v5ba99e0am58872c4ea37f9025@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804111043g6869db1cuf94beb7048092305@mail.gmail.com> <20080411220329.86761241F4@panix5.panix.com> <7a93bd340804111510g313fd15ev3a1faa81998103e1@mail.gmail.com> <1d7ddd110804111519x7f57d169xaa70f876eb5c050c@mail.gmail.com> <7a93bd340804111530v5ba99e0am58872c4ea37f9025@mail.gmail.com> Message-ID: <20080412175251.B04B2241F4@panix5.panix.com> > Brian and I just decided we have to write a real blog post about this, Oh, absolutely. Blog posts are a different animal than README files. For example it works better to be openly opinionated. > And maybe another C-note if they can show an example of a developer > taking a mockup HTML file and merely lightly sprinkling a few > scriptlets in it, as opposed to ripping it to shreds and/or > reimplementing it from scratch. My audience had one guy who apparently was happily doing some version of this (or the designers changed the HTML in the templates and left the code alone, or something like that - there were parts of his workflow that I didn't get, for example there seemed to be lots of designers and just one programmer (him)). I of course said "if it is working for you, fine (although you can find better template languages than ERB), but here's what my project was like" and proceeded to tell the story of the designer who would tell us to change something, and then we'd change it in one place (because we had such things factored out in an Erector-like system) and it would take us a few minutes, and then he would have hours of work ahead of him, because he had to change it in N different places on his mockups for the various pages. That designer on my project was the kind of guy who really liked templates. But I think by the end of the project he could at least see the virtue of doing things in well-factored (low duplication) code. Anyway, there was that one guy at my talk. But the rest of the audience seemed to be nodding or agreeing with me when I suggested having the designer send images rather than HTML, or whatever. From alex at pivotallabs.com Sat Apr 12 18:52:08 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Sat, 12 Apr 2008 15:52:08 -0700 Subject: [Erector-devel] erect Message-ID: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> Do this. Do it now. cd ~/workspace/erector svn up rake install_gem cd ~/workspace rails foo cd foo script/generate scaffold post title:string body:text published:boolean *erect app/views/posts/*.erb* mate app/views/posts sleep 30 # wait for you to stop drooling rm app/views/posts/*.erb (echo ""; echo "require 'erector'") >> config/environment.rb rake db:migrate script/server open http://localhost:3000/posts Erector's Rails integration just went from smooth to smoove. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080412/5ffd5083/attachment.html From alex at pivotallabs.com Sat Apr 12 19:40:45 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Sat, 12 Apr 2008 16:40:45 -0700 Subject: [Erector-devel] New command-line tool for that framework whose name we all like so much Message-ID: <7a93bd340804121640s2bebc15fn744424e4cb0be4ff@mail.gmail.com> It just occurred to me... How many people got the previous email marked as spam? In the below, the boldfaced word is spelled ee arr ee cee tee. On Sat, Apr 12, 2008 at 3:52 PM, Alex Chaffee wrote: > Do this. Do it now. > > cd ~/workspace/erector > svn up > rake install_gem > > cd ~/workspace > rails foo > cd foo > script/generate scaffold post title:string body:text published:boolean > > *erect app/views/posts/*.erb* > > mate app/views/posts > sleep 30 # wait for you to stop drooling > > rm app/views/posts/*.erb > (echo ""; echo "require 'erector'") >> config/environment.rb > rake db:migrate > script/server > open http://localhost:3000/posts > > > Erector's Rails integration just went from smooth to smoove. > > -- > Alex Chaffee - Pivotal Labs > alex at PivotalLabs.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080412/5947770c/attachment-0001.html From kingdon at panix.com Sun Apr 13 19:54:21 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 13 Apr 2008 19:54:21 -0400 (EDT) Subject: [Erector-devel] New command-line tool for that framework whose name we all like so much In-Reply-To: <7a93bd340804121640s2bebc15fn744424e4cb0be4ff@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804121640s2bebc15fn744424e4cb0be4ff@mail.gmail.com> Message-ID: <20080413235421.5C77B241F4@panix5.panix.com> > It just occurred to me... How many people got the previous email marked as > spam? Here are the spamassassin scores as the message arrived here (not enough to mark as spam, but I will note that the 3 things which hit have nothing to do with that suspicious word, as far as I can tell). X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on mailbackend.panix.com X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=HTML_MESSAGE,SARE_MSGID_LONG40, WEIRD_PORT autolearn=disabled version=3.2.3 From kingdon at panix.com Sun Apr 13 21:31:54 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 13 Apr 2008 21:31:54 -0400 (EDT) Subject: [Erector-devel] erect In-Reply-To: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> Message-ID: <20080414013154.54CB1241F4@panix5.panix.com> > erect app/views/posts/*.erb Very cool. My biggest problems were not erector-related (turns out "yum install ruby-sqlite3" is your friend, at least on fedora7 linux). I did find one minor thing; the generated erector code gave the infamous "warning: parenthesize argument(s) for future version". I've checked in a fix which seems to work on the one case I was hitting. If this is the right fix it might also belong at least one other place (namely, for text as well as rawtext). From kingdon at panix.com Sun Apr 13 21:39:51 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 13 Apr 2008 21:39:51 -0400 (EDT) Subject: [Erector-devel] old docs at http://erector.rubyforge.org/rdoc/ Message-ID: <20080414013951.AF786241F4@panix5.panix.com> Can I just run "rake publish_docs" more or less whenever the README.txt changes, or is the idea to sync this with some kind of released gem? In any event, there have been quite a few changes to README.txt since the version which is now at http://erector.rubyforge.org/rdoc/ From alex at pivotallabs.com Mon Apr 14 12:37:09 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Mon, 14 Apr 2008 09:37:09 -0700 Subject: [Erector-devel] erect In-Reply-To: <20080414013154.54CB1241F4@panix5.panix.com> References: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> <20080414013154.54CB1241F4@panix5.panix.com> Message-ID: <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> On Sun, Apr 13, 2008 at 6:31 PM, Jim Kingdon wrote: > > erect app/views/posts/*.erb > > Very cool. > > My biggest problems were not erector-related (turns out "yum install > ruby-sqlite3" is your friend, at least on fedora7 linux). > I think "sudo gem install sqlite3-ruby" works on Mac (and might on other unixes) to get Rails working out of the box again. > > I did find one minor thing; the generated erector code gave the > infamous "warning: parenthesize argument(s) for future version". I've > checked in a fix which seems to work on the one case I was hitting. > If this is the right fix it might also belong at least one other place > (namely, for text as well as rawtext). > I had put in a pending spec for that. I haven't looked at your change yet but I'd prefer it if it only parenthesized printlets with a space in them (i.e. "text(link_to 'foo')" but "text foo"). And yes, it should apply to both <%= and <%=h -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080414/e4015aff/attachment.html From alex at pivotallabs.com Mon Apr 14 12:41:54 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Mon, 14 Apr 2008 09:41:54 -0700 Subject: [Erector-devel] old docs at http://erector.rubyforge.org/rdoc/ In-Reply-To: <20080414013951.AF786241F4@panix5.panix.com> References: <20080414013951.AF786241F4@panix5.panix.com> Message-ID: <7a93bd340804140941q35e7b2f5w3e67640aac69faf2@mail.gmail.com> Right, I forgot -- hoe separates the tasks so if you run "rake release" you also have to run "rake publish_docs" (and "rake publish_web" if you changed that too). Let's make a new release sometime soon (like today) so the new, um, err, tool gets out there. On Sun, Apr 13, 2008 at 6:39 PM, Jim Kingdon wrote: > Can I just run "rake publish_docs" more or less whenever the > README.txt changes, or is the idea to sync this with some kind of > released gem? In any event, there have been quite a few changes to > README.txt since the version which is now at > http://erector.rubyforge.org/rdoc/ > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel > -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080414/48891029/attachment.html From brian at pivotallabs.com Mon Apr 14 21:29:05 2008 From: brian at pivotallabs.com (Brian Takita) Date: Mon, 14 Apr 2008 18:29:05 -0700 Subject: [Erector-devel] erect In-Reply-To: <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> References: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> <20080414013154.54CB1241F4@panix5.panix.com> <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> Message-ID: <1d7ddd110804141829h29d5accka241bbcaf7037ede@mail.gmail.com> On Mon, Apr 14, 2008 at 9:37 AM, Alex Chaffee wrote: > > > > On Sun, Apr 13, 2008 at 6:31 PM, Jim Kingdon wrote: > > > > > erect app/views/posts/*.erb > > > > Very cool. > > > > My biggest problems were not erector-related (turns out "yum install > > ruby-sqlite3" is your friend, at least on fedora7 linux). > > > > I think "sudo gem install sqlite3-ruby" works on Mac (and might on other > unixes) to get Rails working out of the box again. That also works on Ubuntu and probably Fedora. You will need to install the libsqlite3-dev library first though. > > > > > I did find one minor thing; the generated erector code gave the > > infamous "warning: parenthesize argument(s) for future version". I've > > checked in a fix which seems to work on the one case I was hitting. > > If this is the right fix it might also belong at least one other place > > (namely, for text as well as rawtext). > > > > I had put in a pending spec for that. I haven't looked at your change yet > but I'd prefer it if it only parenthesized printlets with a space in them > (i.e. "text(link_to 'foo')" but "text foo"). And yes, it should apply to > both <%= and <%=h > > > > -- > Alex Chaffee - Pivotal Labs > alex at PivotalLabs.com > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel > > From kingdon at panix.com Tue Apr 15 10:41:53 2008 From: kingdon at panix.com (Jim Kingdon) Date: Tue, 15 Apr 2008 10:41:53 -0400 (EDT) Subject: [Erector-devel] erect In-Reply-To: <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> <20080414013154.54CB1241F4@panix5.panix.com> <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> Message-ID: <20080415144153.49E37241F4@panix5.panix.com> > I had put in a pending spec for that. I haven't looked at your change yet > but I'd prefer it if it only parenthesized printlets with a space in them > (i.e. "text(link_to 'foo')" but "text foo"). And yes, it should apply to > both <%= and <%=h Ah, somehow I was able to miss both your pending spec and the rest of the spec files (other than the one I put my spec in). Must have been temporary insanity or misplaced enthusiasm or something... Anyway, I changed it to follow the description above. However, it doesn't fix the warnings on my system (ruby is Fedora's ruby-1.8.6.114-1.fc7). It seems we need rawtext(link_to('foo')) not rawtext(link_to 'foo') I don't know what is going on here. Rails must have a way of dealing with this when it handles a .html.erb file, I would think. From alex at pivotallabs.com Tue Apr 15 13:57:32 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Tue, 15 Apr 2008 10:57:32 -0700 Subject: [Erector-devel] erect In-Reply-To: <20080415144153.49E37241F4@panix5.panix.com> References: <7a93bd340804121552u439c2799s4665b5eb17e3cc7a@mail.gmail.com> <20080414013154.54CB1241F4@panix5.panix.com> <7a93bd340804140937ue660f9i25d346a70012f71e@mail.gmail.com> <20080415144153.49E37241F4@panix5.panix.com> Message-ID: <7a93bd340804151057u79b69dedu29c503b5b6f89aec@mail.gmail.com> > It seems we need > > rawtext(link_to('foo')) > > not > > rawtext(link_to 'foo') > > I don't know what is going on here. Rails must have a way of dealing > with this when it handles a .html.erb file, I would think. > No, it's just an oddly triggered warning. Of the following: 1. foo "bar" 2. text foo "bar" 3. text(foo "bar") 4. text foo("bar") 5. text(foo("bar")) 2 & 3 warn and the rest are fine, including 1 which is what shows up in scaffolding (as "link_to :foo") This probably means we can't mechanically correct the warning, though we might be able to cheat for the exact code generated by scaffolding. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080415/6e2927f9/attachment.html From alex at pivotallabs.com Wed Apr 16 13:31:49 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Wed, 16 Apr 2008 10:31:49 -0700 Subject: [Erector-devel] Erector: braces vs. do..end Message-ID: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> Over the past month, work on Erector has been happening quietly but steadily. Towards the goal of a non-stealth release, our focus has been on documentation, ease of use, and Rails integration. We now have seamless Rails views (thanks to Brian) and a tool that converts RHTML files into Erector classes (thanks to me and to Treetop). We can bicker over which unimplemented or half-implemented features are "must-have" before we open the floodgates, but there's one issue I'd really like to get consensus on before we go much further. As you all know, Ruby allows two syntaxes for blocks: do..end and {..}. Although these are interchangable, the Ruby community has settled on using braces when the block starts and ends on the same line, and do..end in all other cases. I'm proposing that for Erector we promote a different convention: use braces for rendering blocks, but continue to use do..end for control blocks. For example: def render div :class => 'warnings' { span :class => 'label' { text "Warnings:" } warnings.each do |w| span :class => 'message' { text w.message } end } end Arguments in favor: * Erector becomes a rendering DSL with a clear distinction between tags/attributes and their contents * It's easier to see at a glance which code is rendery and which is other methods (the rendery code has braces at the end of lines) * Ruby newbies or code visitors (e.g. designers) will have an easier time moving from <>..<> to {..} than do..end * It's optional; "erect" could take a flag saying which style you prefer (but the default would be braces) Arguments against: * Backlash from hardcore Rubyists who want to obey the multiline -> do..end convention * Maybe do..end feels more DSLy than {..} after all * Who cares if it's optional; the default wins and if it's in the docs Please reply with more arguments if you have them. Or vote if/when you're convinced one way or another. (I'm of the Apache school of voting rules: +1 for, -1 strongly against, -0 against but not enough to veto. We keep bickering and changing votes until either nobody vetoes or the list mom (me) stops the madness.) I'd like to resolve this soon so we can be consistent in docs and "erect" output. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080416/52192ec3/attachment-0001.html From thewoolleyman at gmail.com Wed Apr 16 15:54:35 2008 From: thewoolleyman at gmail.com (Chad Woolley) Date: Wed, 16 Apr 2008 12:54:35 -0700 Subject: [Erector-devel] Erector: braces vs. do..end In-Reply-To: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> References: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> Message-ID: On Wed, Apr 16, 2008 at 10:31 AM, Alex Chaffee wrote: > I'm proposing that for Erector we promote a different > convention -1 Since I have not used Erector yet, take my vote with a grain of salt. This seems like an arbitrary convention to impose, with little benefit. This is still a very ruby-esque DSL (at least based on your example), so following the standard ruby convention seems to follow the principle of least surprise. Having braces used in a way that is non-standard for Ruby will cause enough confusion to outweigh the benefit of distinguishing between tags/attributes and their contents. Follow the standard, and let people do something different if they want. Don't impose an arbitrary standard. "Standard is better than better." -- Chad From kingdon at panix.com Wed Apr 16 23:03:15 2008 From: kingdon at panix.com (Jim Kingdon) Date: Wed, 16 Apr 2008 23:03:15 -0400 (EDT) Subject: [Erector-devel] Erector: braces vs. do..end In-Reply-To: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> (alex@pivotallabs.com) References: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> Message-ID: <20080417030315.38965241AC@panix5.panix.com> > I'm proposing that for Erector we promote a different convention: use > braces for rendering blocks, but continue to use do..end for control > blocks. I'm a little worried about getting laughed out of the Ruby church for it. More concretely (and I suppose more importantly), I suspect I'd find it really hard to remember to follow this convention. Also, I suspect that people who are (somewhat) new to Ruby will find it confusing ("why are some of these do-end and some of them braces?" "Erector must be doing some kind of deep magic to not just use Ruby syntax" etc). So I guess this is a -1. From alex at pivotallabs.com Sat Apr 19 13:44:41 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Sat, 19 Apr 2008 10:44:41 -0700 Subject: [Erector-devel] Erector: braces vs. do..end In-Reply-To: <82c457760804171806h5add0e4g1f79ad8311078e4e@mail.gmail.com> References: <7a93bd340804161031m53804f7dr6c8dd603611bc995@mail.gmail.com> <7a93bd340804171509n6ee82bdege35d66e7f174ecde@mail.gmail.com> <82c457760804171806h5add0e4g1f79ad8311078e4e@mail.gmail.com> Message-ID: <7a93bd340804191044m1b0674bm3f6d7d3dadce0b87@mail.gmail.com> OK, sounds like a consensus. "Erector is code" it is! On Thu, Apr 17, 2008 at 6:06 PM, Nick Kallen wrote: > I'm basically w/ Jim on the issue. Erector is code. It should be idiomatic > ruby. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080419/a80555fb/attachment.html From alex at pivotallabs.com Thu Apr 24 23:15:54 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Thu, 24 Apr 2008 20:15:54 -0700 Subject: [Erector-devel] Erected Web Site Launched Message-ID: <7a93bd340804242015k31734a85s22234a1ba6841248@mail.gmail.com> Check out http://erector.rubyforge.org/ And then check out the latest code and run "rake web" and look at all those .rb files in the web/ directory... Any criticism on the design is more than welcome. -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/erector-devel/attachments/20080424/9ab72b00/attachment.html From alex at pivotallabs.com Wed Apr 30 16:09:09 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Wed, 30 Apr 2008 13:09:09 -0700 Subject: [Erector-devel] Erector question In-Reply-To: <659111b10804301050p76cb3209oac34137565d76dbd@mail.gmail.com> References: <659111b10804301050p76cb3209oac34137565d76dbd@mail.gmail.com> Message-ID: <7a93bd340804301309o2f37077ckc15cd7bf3ecea50@mail.gmail.com> Wynn - Nice to hear from you! Please subscribe to erector-devel to start the technical conversation about fields_for, but the short answer is that we intend to provide either pass-through functions or reimpliementations of all the Rails helpers, but we haven't done that for all of them yet, and we'd love your input (or code+specs) for the ones we've left out. Check out helpers.rb -- it may be that all we need is to add a wrapper for fields_for, or even that it works already since fields_for is part of the form block parameter already. As for GitHub, everyone is talking about moving to Git, but there are a couple of technical issues we want to resolve first, but it shouldn't take long. I'm personally not quite comfortable enough with git to have a clear idea of how to handle version incrementing, syncing with svn, how to name branches, etc. I know I should just leap onto the Gitwagon and learn but I haven't had the time yet. I did make myself a GitHub account last week, though! - A On Wed, Apr 30, 2008 at 10:50 AM, Wynn Netherland wrote: > Hi, Alex, > > I stumbled across Erector yesterday and am intrigued. I've got a > growing number of partials in one of my apps that would benefit from > some inheritance. Since they each wrap up some form fields from > multiple models, I'm relying heavily on fields_for which I didn't see > in your api. I wanted to get your take on the best way to implement > that. Are you proxying the regular Helper methods? Do you have this up > on GitHub by chance? > > Any direction you could provide would be greatly appreciated. > > Thanks! > > -- > Wynn Netherland > Bit Wrangler, Geek Herder > Squeejee > www.squeejee.com > -- Alex Chaffee - Pivotal Labs alex at PivotalLabs.com