(I am not a lawyer. Do not take any of the following as legal advice. It is, however, my understanding as someone who is more than a little bit familiar with certain aspects of copyright law... but could still be completely wrong)
First thing to realize with the question https://softwareengineering.stackexchange.com/questions/230592/would-copyright-drop-if-i-re-do-it-from-scratch-in-different-language (from my reading of it) is that it is neither a licensing nor a copyright question in many situations - it is a contract issue.
For all of the major companies that I worked at, there was a specific clause in the contract that if I wrote software that was directly applicable to my job, even in my off hours on my own equipment, that software would be owned by the company.
For example, at my previous employer I worked on a point of sales system. If I wrote something that was point of sales use (a custom dsl for doing receipts, or rules engine for determining the price of something based on discounts and coupons and sales, etc...) that creation would have been owned by my employer.
I haven't seen similar provisions in my current employer's contract, so this isn't universal, but I'm more inclined to believe that my current employer is the exception rather than the rule.
To that extent:
If on my off hour, I write with a language C, from scratch a program which have a similar goal, but target user base B, and is open source, is it unethical or breaking trade secret/non compete/other?
is likely an answer that can only be determined by "read your contract" and "talk to a lawyer".
Lets assume that this isn't a contract issue.
As described, it could be a copyright issue instead. In this case it is a question of is any of the works in the 'from scratch program' a derivative work of the program written while on the clock. This can only be answered by a lawyer - its not a licensing issue.
The question also asks about trade secret which is completely the domain of lawyers and I couldn't even begin to comment on that - what a company considers a trade secret or not.
There is also the 'non-compete' question in the question. This is likewise a question that is something that varies from jurisdiction to jurisdiction (enforceable in some, not others, and funky rules in yet others). This is also completely in the domain of lawyers to determine what competes and what doesn't.
In total, the question appears to be nearly all legal questions other than licensing. I don't see any license question in there. The copyright part isn't necessarily correct, but that it is a legal question that programmers don't have the expert knowledge of is absolutely correct.
---
Its a fine line between the two topics in some cases. However, most of the closed questions that I've poked at that that have received closed votes are either:
- questions about legality
Is it legal to remove the license information from a GPL compatible license when using it in GPL software?
- questions about non-license issues (contracts)
I am working for XYZ who is using in house modified GPL software. Can I submit those changes back to the main fork?
- "find a license for me"
I am looking for an open source license that prevents military or commercial use. This one is a resource request, despite it being about licensing.
This set of questions makes up the majority of the closed questions relating to licensing. Nearly all of the copyright questions fall into that first group.
The thing that would help the most is to identify a licensing question that was closed with a reason pertaining to copyright that is actually a licensing question that should be open based on the guidelines.