Hacker News new | past | comments | ask | show | jobs | submit | asm's comments login

Clarification on the title of this post; Phan is written in PHP7, but will analyze code written in any version of PHP.


As long as that code can run on PHP7.


Co-author here. Happy to answer any questions folks have about Phan.


Am I right in assuming that the name is a tribute to John Allspaw's rec.music.phish posts from the 90s?

https://groups.google.com/forum/#!search/allspaw$20phriend%7...


This is awesome. Any plans to add autocomplete functionality similar to HHVM's typechecker?


We'd like to get there eventually. Phan populates a sqlite database when analyzing code (if run with the -s flag). This allows fast runs on single file changes or patches. We're hoping to use this for things like auto-complete and finding callers for a class/method/whatever eventually.

For now, we have a primordial Syntastic vim plugin (https://github.com/etsy/phan/blob/master/plugins/vim/bundle/...) for getting errors into the quickfix view.


That's awesome. If a PR was opened that added autocomplete and/or finding callers and/or refactoring (and assuming that the code is good), would you guys be open to merging it? Or would it be delayed so that the core functionality can be focused on?


Definitely.

If you want to start working on that, feel free to open up an issue (https://github.com/etsy/phan/issues/new) to start a conversation about it.

We currently store method/function callers in the sqlite database (see https://github.com/etsy/phan/blob/master/src/Phan/Analyze/Br...), but aren't yet exposing an interface for getting callers. We'll want to store callers for constants, classes, properties and global variables as well.


Meanwhile, have you checked padawan ? https://github.com/mkusher/padawan.php it's a server made to be used by editors for autocompletion of PHP code (like jedi for python) it works pretty well with vim AFAIK


Yep. https://github.com/mkusher/padawan.php/issues/1

Project started after mine. https://github.com/cweagans/theforce

Just ran out of time, so mkusher did his own thing. I disagree with his direction and I think it's overly complex from a user's standpoint, but he disagrees and isn't willing to change it, so I lost interest in that project too.

Using the actual AST from the PHP interpreter is going to be a) much faster and b) much more accurate.


How is performance of Phan? Nested looping checks in phase 2 scans sound intensive and bottleneck-ish.


Analysis takes a lot of CPU and we're not doing any parallel processing. Phan itself is about 30k lines of code and takes about 1.5s for a clean run.

That being said, you should take a look at the '-s' flag for saving state to a sqlite database. After the initial run the stored state can be used to only scan changed files. For a patch with a few files changed it should be about 0.5s to run the analysis.


How Phan treat SIMD in PHP7? Does it pick up what is going on with functions as variables?


Phan does not attempt to make sense of things like `$class_name->$function_name()` or `$$v`. I'd be happy to see a pull request that could handle simple strings, but otherwise I imagine the best we can do is emit a warning.

I'm not sure what SIMD refers to. Can you clarify that?


I wrote this when I had just woke up as I was excited, so I had to get a question in. I think what I meant was passing functions into other functions.

I do this for things like:

$user_requirements = [filter1, filter2];

foreach ($user_requirements as $test) { if (!$test($some_data)) { return false; } return true; }

Is there any way to tell the analyzer to make sure that afunction of n arguments is passed in?


What about `$$$v`? Does it handle `$$$v`?


> I'm not sure what SIMD refers to. Can you clarify that?

With a name like "asm" that comes as a surprise... Single Instruction Multiple Data[0] refers to low level processor instructions that are able to work across a range of data, e.g. video cards working on changing the values in a framebuffer with one instruction mapping across an entire buffer in parallel.

[0] https://en.wikipedia.org/wiki/SIMD


That doesn't clarify what the OP meant. PHP does not allow you to issue processor instructions directly.


I'm going to take a crazy leap here based on the commits. asm might not stand for what you think.


Awesome project, Do you know where I can download a php_ast.dll for the latest php 7 for windows?


I'm not sure. PHP7 is pretty new so package maintainers may not have had a chance to put binary releases together. You may need to compile it yourself from https://github.com/nikic/php-ast.


We used construction paper to black out the back around the tablet. My guess is that the paper wouldn't like the humidity but the rest would be fine. Perhaps you could swap in some black plastic material that would work with spray adhesive.


Wouldn't a coating of black spray paint work just fine?


Hi, I helped hannahmitt make the mirror.

The rectangle of light isn't noticeable at all in normal light if you adjust the brightness on the tablet well. In a dark room it can be noticeable, though.


Unfortunately, the touch screen doesn't work through the mirror, however, we're using reusable sticky stuff to attach the mirror to the tablet, so its easy to remove if needed.



Can you e-mail me with details? My address is in my profile. Thanks!


it looks pretty good. Why do you want to sell it?


It was written to scratch a personal itch; never as a business. I'd be happy to see someone else pick it up and do something with it.


How do you delete an image once it's uploaded?


fixed


That you're asking about keeping it unguessable makes me think that it feels like too few. Its actually only 5 bytes of random (the first character is always zero). 2^40 is a pretty large number and I don't expect to get high coverage over that space any time soon. That being said, perception is important, so I should probably up it.

As for hot-linking; I have no business plan and just wanted to make something useful. I should probably figure that stuff out.


I'd just put up a nice, flat lock somewhere when uploading. If it's locked, pop up a text box where the user can enter a password. If it's open, just do what you do right now.

I personally think a freemium kind of model will work best for a service like this. Allow locking only for logged in users, and give each person 30 locks for free monthly (1 per day on average). For additional locks, either charge a small fee out of the user account (something under a dollar), or charge a given amount monthly for flatrate locks. You should allow people to deposit money into their user account in order to pay for these things. They'll most likely consider it playmoney, and that lowers inhibitions when it comes to buying premium features.


Mobile devices were very much an afterthought. I was getting mobile traffic and did a best effort to make it passable, but I don't recommend it.

You should check out Bugshot (https://itunes.apple.com/us/app/bugshot/id669858907?mt=8) which I think does a much better job on iOS.


That's a good idea, I'll do that. Thanks.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: