LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   writing a few lines of comments that work in most languages (https://www.linuxquestions.org/questions/programming-9/writing-a-few-lines-of-comments-that-work-in-most-languages-4175723599/)

rtmistler 04-23-2023 09:49 AM

Quote:

Originally Posted by Skaperen (Post 6426411)
the idea is to be able to attach a small amount of data to a file that in the context of the file, does not affect the file, but can still be recognized as being there, extracted, decoded, (if needed), etc.

Well that's not "comments".

Comments are there to aid the code, not to be taken out, decoded, or have zero impact to the file. Yes they have zero impact to the parser, that's the intent and definition of a comment. Instead you're proposing something like markup language.

Reading this makes me feel the same as that user who is continually inventing their own language for years.

NevemTeve 04-23-2023 10:51 AM

Java has annotations which is some sort of alternative data-stream in the class files.

dugan 04-23-2023 12:22 PM

Quote:

Originally Posted by Skaperen (Post 6426411)
suppose uuencode did not exist and i was designing something to make it easy to include a binary file in email. would you still wonder why?

You're asking us to consider an alternate scenario in which you clearly stated what you were doing and why you were doing it?

Skaperen 04-25-2023 05:04 PM

Quote:

Originally Posted by dugan (Post 6426416)
But uuencode does exist, and if you were trying to reinvent it we'd tell you to use base64.

at least you wouldn't be saying that uuencode could be better than base64.

Quote:

Originally Posted by dugan (Post 6426416)
Are you being deliberately vague (to avoid revealing proprietary information, or because you don't want your idea stolen, or whatever), or is this actually how well-formed and specific your idea actually is?

i try to express my questions in a way to keep the discussion on topic. when i put more details out there, many people avoid the topic and focus where they should not.

Quote:

Originally Posted by dugan (Post 6426416)
(Earlier, I actually stopped myself from wondering out loud if you this was a scheme to hide your porn collection).

now i know why you want a copy of my source code :D

Skaperen 04-25-2023 05:16 PM

Quote:

Originally Posted by rtmistler (Post 6426524)
Well that's not "comments".

Comments are there to aid the code, not to be taken out, decoded, or have zero impact to the file. Yes they have zero impact to the parser, that's the intent and definition of a comment. Instead you're proposing something like markup language.

call it "markup" if you want. if you know another way to get the language to be compiled with no effect for that, then i'd to have you say how. in the mean time, having information disguise itself as a comment (while revealing to certain tools) achieves the goal. an archive tool could also do this except that the goal is for the goal is for zero impact whether the added "faked" code is removed or remains in place.

dugan 04-25-2023 05:18 PM

Quote:

Originally Posted by Skaperen (Post 6426973)
i try to express my questions in a way to keep the discussion on topic. when i put more details out there, many people avoid the topic and focus where they should not.

Oh, so it's deliberate? And you kept it up after, *checks* over three weeks of everyone telling you that they have no idea what you're talking about?

This isn't working, and I've wasted enough time with this.

* permanently puts Skaperen in ignore list

Skaperen 04-25-2023 05:21 PM

Quote:

Originally Posted by dugan (Post 6426562)
You're asking us to consider an alternate scenario in which you clearly stated what you were doing and why you were doing it?

no. that was in response to post #43 by pan64 to understand the "You can put whatever you want in your files. But why?".

Skaperen 04-25-2023 05:25 PM

Quote:

Originally Posted by NevemTeve (Post 6426541)
Java has annotations which is some sort of alternative data-stream in the class files.

i don't know Java. if knowing that has value in the context of this thread, maybe you can explain more.

NevemTeve 04-26-2023 12:34 AM

Going back to the original problem: what have you done so far and where are you stuck? Do you still have any open questions?

pan64 04-26-2023 12:35 AM

Quote:

Originally Posted by Skaperen (Post 6421294)
i want to write some reasonably arbitrary text as comments to be prepended and/or appended to source code for most languages or all major languages used in BSD or Linux the code that will write this commented text will not know which language it is, or get to even see the code that the comments will be attached to for to guess the language.

Quote:

Originally Posted by Skaperen (Post 6426979)
i don't know Java. if knowing that has value in the context of this thread, maybe you can explain more.

Java is definitely a major language, it looks like you need to be familiar with it.

Quote:

Originally Posted by rtmistler (Post 6426524)
Well that's not "comments".

Comments are there to aid the code, not to be taken out, decoded, or have zero impact to the file. Yes they have zero impact to the parser, that's the intent and definition of a comment.

Comments [can be] used to [auto]generate documentation and also pass options/flags to different linters, analyzers and other tools working on the code.
(but I still don't understand what is it all about)

dugan 04-26-2023 08:15 AM

Quote:

Originally Posted by pan64 (Post 6427028)
(but I still don't understand what is it all about)

Skaperen made sure that you did not know what it was about, because he wants to keep the thread on topic. If you knew what it was about, then you would avoid the topic and focus on what you should not.

He said that.

astrogeek 04-26-2023 03:17 PM

@OP:

The vagueness of your question and lack of useful additional info has left others, myself included still guessing as to what your actual use case is. Clearly this is beginning to annoy some who have taken time to reply and have received no clarification, all of whom it seems have participated in good faith (and thanks to all), so I think it is time to either provide some useful information, or call it a day for this thread.

I ask you to please review the Site FAQ for guidance in asking well formed questions. Especially visit the link from that page, How to Ask Questions the Smart Way for discussion of things to consider when asking others for help.

After doing so please reformulate your question (in this thread for continuity), preferably providing a specific example of data you wish to include in your not-really-a-comment (for want of a better term) and an example or two of how you would want that to be inserted into some particular language familiar to yourself and others, and explain why simply including it as a comment does not work for you, in order to illustrate your goal. Otherwise, let's all let this thread fade into the mists.

Skaperen 04-30-2023 12:59 AM

Quote:

Originally Posted by NevemTeve (Post 6427027)
Going back to the original problem: what have you done so far and where are you stuck? Do you still have any open questions?

i have done nothing more than just think about the "problem" which initially is trying to find if there is a way to tag a source file more directly than trying to define a container for the content and the tag. i could do this by using what each language defines as a comment. but my program would have to know or detect which language it is. a common way that spans many of today's languages would be the answer. and this can be put in front or behind the file, simplifying how this could be designed (insert in the middle could be more complex). i am "stuck" thinking about it. i have thought about it a few times over the years. i'm about to give up on it and do a container.

Skaperen 04-30-2023 01:02 AM

> Java is definitely a major language, it looks like you need to be familiar with it.

i need to learn how to make a comment in Java. beyond that does not meet my needs.


All times are GMT -5. The time now is 04:46 PM.