安裝 Steam
登入
|
語言
簡體中文
日本語(日文)
한국어(韓文)
ไทย(泰文)
Български(保加利亞文)
Čeština(捷克文)
Dansk(丹麥文)
Deutsch(德文)
English(英文)
Español - España(西班牙文 - 西班牙)
Español - Latinoamérica(西班牙文 - 拉丁美洲)
Ελληνικά(希臘文)
Français(法文)
Italiano(義大利文)
Bahasa Indonesia(印尼語)
Magyar(匈牙利文)
Nederlands(荷蘭文)
Norsk(挪威文)
Polski(波蘭文)
Português(葡萄牙文 - 葡萄牙)
Português - Brasil(葡萄牙文 - 巴西)
Română(羅馬尼亞文)
Русский(俄文)
Suomi(芬蘭文)
Svenska(瑞典文)
Türkçe(土耳其文)
tiếng Việt(越南文)
Українська(烏克蘭文)
回報翻譯問題
This might just be adding oil to the flames, but I'll try to explain the problem anyway.
There is nothing worse than spending a whole week going through your code to find out why it randomly stops working at seemingly unrelated moments, only to find out that it was caused by an update in some third party library that "fixed" a known bug. I actually know someone that reintroduced a bug to his code, because too many parties complained that his "undocumented feature" stopped working.
Trust me, if you don't have to, don't rely on things that are not documented as features. I'm not trying to say that you have to write perfect code or anything, I'm justing asking you to think about the pros and cons of the choices you make. If in the end you still want to do it the way you have been doing, that's perfectly fine, but at least you will have had the chance to make that choice (I'm starting to sound really cheesy right now, so I'm going to stop here before it gets any worse).
No offense taken. Usually (and now I am taking in my work experience, which is indeed 100% subjective) there is an unspoken rule about not changing documented functions (or when you are doing so, leaving the old function there for an entire major version, adding an @deprecated to the function signature and notifying people of this in changelogs).
But you are correct that nothing is stopping people from changing documented features in the same way that I am describing could happen to undocumented features. It's just that my experience is that it is a bigger issue if something undocumented changes than when something documented changes (and as I said before, yes, that is subjective, I'll admit that).
I'll think on your words some more, but I probably won't be adding to this discussion anymore, because I don't think I have anything (constructive) left to add. If you (or anyone else that reads this) think there is something to learn from my experiences, I'm glad that I shared them, and if not then it's not like I lost anything by sharing them.
Thanks for responding seriously btw (it gets me to think if people present opposing views in a way I can't just bulldoze over them).
Documented features tend to not change unless something unforeseen occurs that requires it, and can be a learning opportunity for the api designer that they should try and improve in foreseeing things, though not everything can be foreseen.
Undocumented features are subject to change at any time and without notice, at the whims of the author. You really are not supposed to be taking advantage of undocumented features and so you do so at your own risk. Using undocumented features may make your coding easier, but realize you are taking risks doing so. And also, taking the easy way out isn't the best way to learn and improve your coding skills. But everyone is free to decide for themselves what they want to do.
ns.installBackdoor is not a function
stack:
TypeError: ns.installBackdoor is not a function
It is a singularity function which requires source file 4:
await ns.singularity.installBackdoor ( );
if you don't have SF4 yet you can try my script
https://steamcommunity.com/sharedfiles/filedetails/?id=3022646335
export function netScan(ns, grab) {
let serversToScan = [{ hostname: "home", path: [] }];
let discoveredServers = [];
//let network = [];
grab = grab || (() => { });
while (serversToScan.length > 0) {
let server = serversToScan.pop();
server.path.push(server.hostname);
grab(server);
//network.push(extendFunction(server, ...params));
discoveredServers.push(server.hostname);
for (let connectedServer of ns.scan(server.hostname)) {
if (!discoveredServers.includes(connectedServer)) {
serversToScan.push({
hostname: connectedServer,
path: [...server.path],
});
}
}
}
}
/** @param {NS} ns */
export async function netScanAsync(ns, grab) {
let serversToScan = [{ hostname: "home", path: [] }];
let discoveredServers = [];
//let network = [];
grab = grab || (() => { });
while (serversToScan.length > 0) {
let server = serversToScan.pop();
server.path.push(server.hostname);
await grab(server);
//network.push(extendFunction(server, ...params));
discoveredServers.push(server.hostname);
for (let connectedServer of ns.scan(server.hostname)) {
if (!discoveredServers.includes(connectedServer)) {
serversToScan.push({
hostname: connectedServer,
path: [...server.path],
});
}
}
}
}
Those are my 2 lib functions that scans the network (sync and async).
you can pass a callback as parameter that will receive the hostname and the path of the server.