[ColdBox 4.3.0] Symmetrical braces in generated code

13 views
Skip to first unread message

Dave Merrill

unread,
Sep 19, 2017, 10:34:45 AM9/19/17
to ColdBox Platform
In my personal projects, I've used symmetrical braces forever. Work does too, and I didn't start that. It just seems much more logical and readable to me than K & R-style, makes code structure much clearer.

For example:

Symmetrical:
function foo()
{
  doStuff();
  if (something()
  {
    for (bar in splat)
    {
      doMoreStuff(bar);

      andYetMore(bar.splat);
    }
  }
}

K & R:
function foo() {
  doStuff();

  if (something() {

    for (bar in splat) {
      doMoreStuff(bar);

      andYetMore(bar.splat);
    }

}


I'm not asking anyone to agree, just wondering if there's a way to tell the CommandBox generators for ColdBox to use symmetrical style braces? Probably not, but thought I'd ask.

br...@bradwood.com

unread,
Sep 19, 2017, 10:41:25 AM9/19/17
to col...@googlegroups.com
The coldbox create app command can be pointed at any endpoint so you can have a custom app skeleton if you want.  However the commands like coldbox create handler aren't customizable.  This has been suggested before
 
Please add any thoughts or suggestions to that ticket, or feel free to take a stab at it and offer a pull request.  Minimally, a user could specify an external directory of templates for the scaffolding commands to look at.  It would be sort of messy, but it would work.  There's quite a few individual template files especially with the tag and script version of everything.
 

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/436c744b-f9f9-43d4-bdbf-ea16fc6d0478%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Merrill

unread,
Sep 19, 2017, 10:41:54 PM9/19/17
to ColdBox Platform
Hmmm, alternate templates just to change brace indenting isn't really what I was imagining.

I use IntelliJ IDEA as my editor, and like many editors, it has Code Style settings, customizable by language, which can be applied to code that's already written. I wonder if there are "pluggable" versions of that sort of functionality. If so, the ability to process the existing templates through something like that would be pretty nice.

OTOH, it's not that important, since IDEA can do it after the fact. Would be cool though :)

Dave



On Tuesday, September 19, 2017 at 10:41:25 AM UTC-4, Brad Wood wrote:
The coldbox create app command can be pointed at any endpoint so you can have a custom app skeleton if you want.  However the commands like coldbox create handler aren't customizable.  This has been suggested before
 
Please add any thoughts or suggestions to that ticket, or feel free to take a stab at it and offer a pull request.  Minimally, a user could specify an external directory of templates for the scaffolding commands to look at.  It would be sort of messy, but it would work.  There's quite a few individual template files especially with the tag and script version of everything.
 

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

Reply all
Reply to author
Forward
0 new messages