Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

is this going to be solved by writing it in javascript though?

Looking at the sample code in this page:

   Mail.outgoingMessages.whose({subject:'JavaScript'})
is doesn't look much better.


Looks pretty straightforward to me. Do you know what the equivalent AppleScript is?

Edit: found a stack overflow question/answer [1]. It's doing a little additional work beyond searching for mails with a particular subject, but even just the searching functionality is much larger and more convoluted that the single line of js you referenced.

[1]http://stackoverflow.com/q/8156120


    tell application "Mail"
        set msgs to every outgoing message whose subject is 'JavsScript'
    end tell

So, yes :).


This is about as simple as an API goes. What did you expect to see exactly?

doWhatImThinking();


It's not ease of use I'm talking about, I was referring to API discoverability/ease of finding what you need.

Since the javascript code looks isomorphic to

   outgoing messages whose subject is "JavaScript"
I'd think that the issue is not mitigated by a different syntax.


I never understood the cutesy naming schemes. What's wrong with .filter or .where.


Agree. Hopefully (?) it's just JS by the point we get to `Mail.outgoingMessages` so it should be fairly straightforward to mix-in underscore's methods into whatever their 'collection' representation is, the same way Backbone does [1] to give you map/filter/which etc.

[1] http://backbonejs.org/#Collection-Underscore-Methods


In fact, you can use either “whose” or “where”, and the AppleScript language guide refers to this as “Filter”:

<https://developer.apple.com/library/mac/documentation/apples...


I agree, but I guess .filter or .where could be more difficult to understand for beginners.


Looks very Ruby-esque.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: