Home Download Buy Blog Forum Support

Shebang Syntax

Re: Shebang Syntax

Postby vxnick on Fri Mar 23, 2012 1:34 pm

Hi Dominique,

Ah, thanks for clarifying :-)

So your issue with DetectSyntax is that it use regex, right ?
I'm pretty sure that phillip.koebbe can add something like "first_line_noregex" to is config file in less that five minutes.. if he want... and if you ask him...


I don't have a problem with regex, but I know some people don't know it at all or aren't very confident with it. I'm sure Phillip could do that, but the difference is that my plugin checks if 'env' is specified as part of the shebang (and ignores it). This allows for things like '#!/usr/bin/python' as well as '#!/usr/bin/env python'. That could be done with regex with DetectSyntax, but again it comes down to what the user is able to do. There would also be a lot of duplication - you would need the same regex for each language (PHP, Python, Ruby, Bash, etc) - it'd get quite messy :-)

I totally disagree with this view.
It's not the job of wbond to check every package that people want to be added to Package Control, with the current trend it will a full time job in a few months...
This is a community driven repository so people could and have to give their opinions about its content, and this is why three people already ask you to think about it's inclusion in Package Control.


Sorry, I probably didn't phrase it right - I said that as I've noticed Will commenting on some other pull requests to that effect.

OK - I know when I'm defeated, so I'll remove my pull request from Package Control. As I said previously, I don't expect this plugin to last very long anyway, as it's likely to be fixed soon (if not already, in a dev build) in Sublime core.

I appreciate all your feedback everyone, even though we may not agree - slightly disappointing reception for my first plugin, but such is life :-)
vxnick
 
Posts: 6
Joined: Wed Mar 21, 2012 8:14 pm
Location: Portsmouth, UK

Re: Shebang Syntax

Postby bizoo on Fri Mar 23, 2012 3:42 pm

vxnick wrote:OK - I know when I'm defeated, so I'll remove my pull request from Package Control. As I said previously, I don't expect this plugin to last very long anyway, as it's likely to be fixed soon (if not already, in a dev build) in Sublime core.

Please, don't take it that way, it was not a battle and there is no winner or loser. Simply people with different opinion.
I'm sure phillip.koebbe will read this topics and add something to his plugin for non regex guru user.

vxnick wrote:I appreciate all your feedback everyone, even though we may not agree - slightly disappointing reception for my first plugin, but such is life :-)

I appreciate this discussion and really hope to see others plugins coming from you soon, the mixed reception with this plugin is unrelated to the plugin itself (again with a really clean and well commented code).

See you soon.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Shebang Syntax

Postby nick. on Fri Mar 23, 2012 3:49 pm

I can appreciate the stances of both "sides", and I'm not going to push the discussion about what should be done any further except to say that this was one of the most well handled disagreements I've ever encountered on the internet. Kudos to you all!
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Shebang Syntax

Postby vxnick on Fri Mar 23, 2012 3:52 pm

bizoo wrote:Please, don't take it that way

That was meant in jest - don't worry :-)

Nick - thanks, it's appreciated!
vxnick
 
Posts: 6
Joined: Wed Mar 21, 2012 8:14 pm
Location: Portsmouth, UK

Re: Shebang Syntax

Postby phillip.koebbe on Fri Mar 23, 2012 7:27 pm

bizoo wrote:I'm sure phillip.koebbe will read this topics and add something to his plugin for non regex guru user.


Ah, you put me on the spot! Heh heh.

Actually, what vxnick wanted makes a ton of sense. It has been just within the past two or three years that I've been using regular expressions, and I'm far from being a guru with them. But I decided to rely on them to make the plugin less complicated and brittle. The first pass I made at it was not regexp dependent and it was a nightmare. Once I had the "Aha!" moment of being able to handle just about everything with regexps, the code became considerably simpler.

Anyway, I just pushed a change that adds support for a "binary" rule type which works by taking whatever you supply and making a shebang regexp for you. So you can now do this:

Code: Select all
{"binary": "ruby"}


instead of

Code: Select all
{"first_line": "^#\\!(?:.+)ruby"}


I haven't tested this extensively, but this should allow one to catch any variation of a base binary, such as ruby18, ruby19, php, php4, php5, etc.

Regarding the proliferation of plugins, I can see both sides. It is very frustrating when multiple plugins do essentially the same thing, but at the same time, I wouldn't want to see people not try to solve a problem in a slightly different way. One thing I've learned over the years is we don't all think the same way (this is true for most, if not all, areas of life, not just plugin development :) ), so one person's neato solution to a problem isn't going to ring bells with everyone. Besides, choice is good.

I don't want to stir this debate up again, but I figured since I got pulled into it ;) , I might as well toss in a penny or two while I'm here. Oh, and I wholeheartedly agree that the difference of opinion was handled very well.

Cheers and peace to all!

P.S. And just for posterity, the "first_line" rule type is a consolidation of what originally was "first_line" and "shebang". In my earliest attempts at this plugin, I was trying to handle shebangs separately from things like the first line of an XML file. When I decided to handle everything with regular expressions, I didn't think "shebang" was generic enough to reasonably apply to all situations. *shrug* I don't really like "first_line", but it works.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Previous

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 5 guests