Is it possible to have some parts editable but others not when sharing an OnlineGDB program?

+1 vote
asked Jun 16 by Rahul Choubey (480 points)
I have created a custom "Wheel of Names" style program in Python using OnlineGDB. It has two files: the file(with all the code) and NameList.txt. I want to have people with whom I share this program can edit NameList.txt without touching the code. Is there a solution?

1 Answer

0 votes
answered Jun 16 by Peter Minarik (9,500 points)
  1. save your project ("Save" button above the code edit window)
  2. go to "My Project" on the left navigation panel
  3. select the project you want to share and click "share/embed"
  4. copy link for "Share code"
  5. Give the link to people you want to share you project with.
  6. People have to "Fork this" on the top panel, when they receive it, so they can work on their own version (fork) of the same project.
This way you can share you code without others being able to modify your version (but they can modify and save their version).
Is this what you're looking for?
commented Jun 17 by Rahul Choubey (480 points)
No, it is not. I want it such that one part of the program can be edited WITHOUT forking, while the program cannot be edited without forking it.
commented Jun 17 by Peter Minarik (9,500 points)
edited Jun 17 by Peter Minarik
I don't think this is supported.

If what you want to achieve is others to use some of your functions, call them, use the results, but do not modify these functions, then Online GDB is not the tool for this.

This can be achieved though: you create (compile) a library and share the library with your users so they can have access to all the exported/exposed/public/shared (terminology varies) methods and classes. But, since they do not have the source code, but only the compiled binary, they cannot modify them.

Is this more what you're after?

E.g. I can create a library called AreaUtils that contains methods for calculating the area of triangles, rectangles and circles. Others can call these methods, but since AreaUtils is a compiled binary, they cannot modify it.

Note: The above is generic information, not specific to Python. I am not too experienced in Python, but there may be a way for create compiled (binary) Python libraries too. I'm afraid, you need to do a bit of research (use your favourite search engine).

UPDATE: I see you modified the original description. Now it's much clearer what you're after.

Unfortunately my answer is the same: I don't think OnlineGDB supports this. If you share your project everyone will get a "copy" of it and they can modify their copy of your original code the way they want it. I don't know of any way to have different access modifiers for various files.

Out of curiosity: why is it important for you that they do not modify the source code? I mean, even if you could limit them not to be able to chance "your code"  they can just copy-paste it into a new project and modify it there.
commented Jun 18 by Rahul Choubey (480 points)
They can, but that’s not what I meant.
Do you know of any other IDE that allows for this?
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.