this is semi-off topic but still related to ror. i had a problem with testing my depot program (which i follow the tutorial in agile web development book). it took me many hours to solved the problem. all the while i thought i was using spaces inside the test/fixtures/products.yml programmer_book: id: 1 title: Pragmatic Programmer description: Best book for the programmer image_url: http://localhost:3000/images/pp.jpg price: 29.95 date_available: 2006-05-01 00:00:00 ^^ ^^^^ the culprit is there were tabs in my code, before the key (id, title,...). replaced it with space and now my program/testing worked. im using vim and i was thinking of changing my preferences on tabbing/indenting. instead of tabs, it will insert spaces. but i want to know if there are any implications on using space instead of tabs in the code. thanks. -- Posted via http://www.ruby-forum.com/.
Hi seems that (although I wasn''t aware of that) tab are prohibited under YAML (see http://www.yaml.org/faq.html) cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060505/67a84b52/attachment.html
malamute jute wrote:> im using vim and i was thinking of changing my preferences on > tabbing/indenting. instead of tabs, it will insert spaces. but i want to > know if there are any implications on using space instead of tabs in the > code. thanks.In YAML, as has already been pointed out, tabs are banned. In code? That''s a religious question, but I think the tendency among rubyists is towards spaces over tabs, because you can''t guarantee the appearance of indentation with tabs. There is (as I understand it) currently an issue with RMagick on Windows related to tabs in code, but that''s definitely a bug somewhere. They should be interchangable. -- Alex
On May 5, 2006, at 9:13 AM, Alex Young wrote:> malamute jute wrote: >> im using vim and i was thinking of changing my preferences on >> tabbing/indenting. instead of tabs, it will insert spaces. but i >> want to know if there are any implications on using space instead >> of tabs in the code. thanks. > > In YAML, as has already been pointed out, tabs are banned. In > code? That''s a religious question, but I think the tendency among > rubyists is towards spaces over tabs, because you can''t guarantee > the appearance of indentation with tabs. > > There is (as I understand it) currently an issue with RMagick on > Windows related to tabs in code, but that''s definitely a bug > somewhere. They should be interchangable.You probably won''t run into this dealing with Ruby, but if you write old fashioned Makefiles, they *require* tabs. And if you use spaces in your make rules, it gives a rather cryptic error message...yeah, that one took me a while to track down. grrr Other than that, I prefer spaces ... especially if swapping code with others! :) -Derrick
On Fri, 5 May 2006, malamute jute wrote:> im using vim and i was thinking of changing my preferences on > tabbing/indenting. instead of tabs, it will insert spaces. but i want to > know if there are any implications on using space instead of tabs in the > code. thanks.The Ruby and Rails folks seem to prefer spaces, with two spaces per indentation level. The Rails website actually says this is what you should use if you want to contribute code. Myself, I prefer tabs, but I suspect I''ll move to what the community uses because it isn''t worth struggling with. I use vim all the time as well, and it''s default bindings with the tabs and autoindent have been making me insane, and I probably will finally go in and shut them off. -- Louis Erickson - lerickson@rdwarf.net - http://www.rdwarf.com/~wwonko/ Hartley''s Second Law: Never sleep with anyone crazier than yourself.
On May 5, 2006, at 7:10 AM, Louis Erickson wrote:> On Fri, 5 May 2006, malamute jute wrote: > >> im using vim and i was thinking of changing my preferences on >> tabbing/indenting. instead of tabs, it will insert spaces. but i >> want to >> know if there are any implications on using space instead of tabs >> in the >> code. thanks. > > The Ruby and Rails folks seem to prefer spaces, with two spaces per > indentation level. The Rails website actually says this is what you > should use if you want to contribute code. > > Myself, I prefer tabs, but I suspect I''ll move to what the > community uses > because it isn''t worth struggling with. > > I use vim all the time as well, and it''s default bindings with the > tabs > and autoindent have been making me insane, and I probably will > finally go > in and shut them off. > > -- > Louis Erickson - lerickson@rdwarf.net - http://www.rdwarf.com/~wwonko/ >FOr ruby code I always use spaces. It is what most of the ruby code you will find uses. And a really good reason not to use tabs is that when you use tabs, you can no longer paster your code into irb to play with it for testing. Irb will see each tab as a command completion requests and flip out on you. Since irb is such an indespensible tool for ruby code, this fact alone warrants only ever using spaces. Cheers- -Ezra
So what is the main reason why the rails community uses spaces instead of tabs? I''ve always used tabs because it offers control of how much white space is shown to the current person editing the file, not who originally wrote it. My coworker likes to have 8 char wide tabs, I personally hate that and like to edit with 4 char wide tabs and maybe others like 2. Rob On 5/5/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote:> > > On May 5, 2006, at 7:10 AM, Louis Erickson wrote: > > > On Fri, 5 May 2006, malamute jute wrote: > > > >> im using vim and i was thinking of changing my preferences on > >> tabbing/indenting. instead of tabs, it will insert spaces. but i > >> want to > >> know if there are any implications on using space instead of tabs > >> in the > >> code. thanks. > > > > The Ruby and Rails folks seem to prefer spaces, with two spaces per > > indentation level. The Rails website actually says this is what you > > should use if you want to contribute code. > > > > Myself, I prefer tabs, but I suspect I''ll move to what the > > community uses > > because it isn''t worth struggling with. > > > > I use vim all the time as well, and it''s default bindings with the > > tabs > > and autoindent have been making me insane, and I probably will > > finally go > > in and shut them off. > > > > -- > > Louis Erickson - lerickson@rdwarf.net - http://www.rdwarf.com/~wwonko/ > > > > > FOr ruby code I always use spaces. It is what most of the ruby code > you will find uses. And a really good reason not to use tabs is that > when you use tabs, you can no longer paster your code into irb to > play with it for testing. Irb will see each tab as a command > completion requests and flip out on you. Since irb is such an > indespensible tool for ruby code, this fact alone warrants only ever > using spaces. > > Cheers- > -Ezra > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- c++: the power, elegance and simplicity of a hand grenade http://www.migrob.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060505/2a34019b/attachment-0001.html
Rob Merrell wrote:> So what is the main reason why the rails community uses spaces instead > of > tabs? I''ve always used tabs because it offers control of how much white > space is shown to the current person editing the file, not who > originally > wrote it. My coworker likes to have 8 char wide tabs, I personally hate > that and like to edit with 4 char wide tabs and maybe others like 2. > > RobIt keeps code looking nice 2 space tabs: SomeModel.create :value => 1, :foo => 123, :bar => ''asdf'' now convert that to 4 space tabs and you have something like: SomeModel.create :value => 1, :foo => 123, :bar => ''asdf'' -- Posted via http://www.ruby-forum.com/.