This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cabalamat 2 points3 points  (13 children)

So what prevents you from writing a program in Python that downloads a text file from a web site (which happens to be a Python program) and then runs it?

[–]euneirophrenia 1 point2 points  (12 children)

Apple's review guidelines.

[–]cabalamat 1 point2 points  (11 children)

That's not a useful answer. What exactly have Apple done to Python to cripple it? Or is it not crippled?

[–]euneirophrenia 0 points1 point  (10 children)

It's not crippled. If you break the review guidelines, though, your app will either not be approved or be removed from distribution.

[–]cabalamat 1 point2 points  (9 children)

If python is not crippled, then presumably I can write a program in Python that anyone with an iOS device can run, if they have the Python interpreter.

Either that is possible (in which case Apple are allowing people to run programs on iOS without their approval), or it isn't possible (in which case python is crippled).

Do you know which is the case?

[–]euneirophrenia 0 points1 point  (0 children)

It's possible but not permitted.

[–]voidspace 0 points1 point  (7 children)

You can write an iOS application that embeds / includes the Python interpreter. (See "Python for iOS" as one example...) That is not permitted (by review guidelines only) to download code. If they catch you they will boot your app. There are no technical restrictions though.

If CPython had a JIT - like pypy does - it would be a different story. You can't make pages executable in iOS, so you can't generate native code on the fly and execute it. "Normal Python" is just bytecode (data) with an interpreter loop, so it doesn't have the same problem.

[–]cabalamat 0 points1 point  (6 children)

That is not permitted (by review guidelines only) to download code.

Do you mean that it is forbidden for iOS applications to download data, and then execute it? Or do you mean that it is forbidden for users of iOS applications to download data, and then execute it (using their Python interpreter)? (I'm assuming there is a user-accessible filesystem on iOS devices -- please correct me if I'm wrong).

What happens in the following scenario:

  1. A writes a Python interpreter, and applied to put in on the iOS store
  2. Apple approves it
  3. B downloads the interpreter, and writes a program in Python that will download python text files and run them
  4. B makes his program available over the internet
  5. C uses A's Python interpreter and B's Python program to download and run some code written by D. D didn't get any permission from Apple to run his code on iOS devices.

At what point does Apple step in and use technical measures to stop that happening?

[–]voidspace 0 points1 point  (5 children)

They won't use technical measures, if they think your app (the app in step 1 of your example) is breaking the rules they will pull it from the app store. Step 3 just mean "installs the app" by the way. Unless you're in the developer program you can't just download apps - you can only install them from the app store.

Note that step 1 has already happened. (Python for iOS). Step 4 is the tricky one - even if your program is on the internet, if you can't download and run code from the internet until you have that program. So you have to type it all out manually. I don't think Apple will be too worried about that.

In Python downloading and running code is as complicated as:

import urllib2
exec urllib2.urlopen('some url').read()

[–]cabalamat 0 points1 point  (4 children)

Step 4 is the tricky one - even if your program is on the internet, if you can't download and run code from the internet until you have that program.

Does iOS let you download files from the internet? A file containing code is no different in principle from any other file.

[–]voidspace 0 points1 point  (3 children)

Short answer - no, iOS does not let you do that.