-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"true" should not be hardcoded #19
Comments
or simply |
In theory, the ES standard could update the definition of |
Also worth noting that the strict equality operator is not necessary with |
Perhaps then we should look into #7 caching again |
It's also theoretically possible that the laws of logic could change, and this could no longer be true. Ideally we'd find an even more bulletproof way to represent this. |
Perhaps we could try calling the unix tool |
I would rather depend on a wasm-compiled version of true tool. |
just in case the fundamental law of thermodynamic changes in the future, how can we think of a better/more future proof way to build a computer on which this library runs on? |
Any serious effort here needs to take all the various Quantum Computing models into account. |
Have we considered the following? return !undefined; I am assuming To be completely safe and backwards-compatible, we can define our own module.exports = function aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue () {
return function (undefined) {
return !undefined
}();
}; |
This could be an interesting approach, although conceptually this is relying on JavaScript type-coercion behavior, which seems less strict than the rigorous and obviously hugely beneficial typing approach conceived of here: #25 |
I've updated the PR and skipped type-coercion altogether. return undefined === anotherUndefined; |
Wouldn't it make sense to have a serverless function somewhere which this function references? That would also help horizontal scaling if a project requires a lot of true's/ye's/yes's/affirmatives's. |
To truly make this library future-proof against the onslaught of frequent changes to javascript's core language features, I think it's probably best if we do not generate the value true ourselves but require the caller to supply it as parameter to the library's public API. The code would look like this: module.exports = function aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue (trueValue) {
return trueValue;
}; then for users of the library, they'd interact with it like this: if(aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue(true)) This way we can ensure that this library will always work, by offloading the burden of maintenance to the end users and off our own hands. |
@j141 I agree with you but user codebase can also be affected by the frequently changing language, making the library non-functional. I think the best way to tackle this is to train a machine-learning based model to dynamically learn what value "true" should be in a given runtime, preferably implemented without using the "true" value, to avoid bootstrapping problem. |
I really like these ideas about future proofing this library. One thing that's certain and has been proven time and again is the reliability and long-term efficacy of the blockchain. If we offload the work of this library onto the blockchain, the value of |
Has anyone considered the impact of quantum computing here? |
@dandean One $LUNA as fee for one "true" invoke, sounds like a good idea (AND a great deal!) |
Seems like a good idea at first, but this opens attack vectors (especially MItM and corruption). Docker fixes this. What if we shipped a container running Node.js version 12, and relied on this version to define |
Good thoughts here. But there would have to be some way of safely updating the OS/Node versions, as well as whatever version of the container or VM technology we choose. So critical to be forward-thinking in these areas. |
You can use axios to download an image of the text true, and then use tesseract to get the text of the image and then use the var IMAGE_URI =
"https://mma.prnewswire.com/media/1009614/True_Logo.jpg?p=twitter"
var Tesseract = require("tesseract.js")
var axios = require("axios")
var fs = require("node:fs")
module.exports =
function aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue() {
return new Promise(function (resolve) {
axios
.get(IMAGE_URI, { responseType: "arraybuffer" })
.then(function (response) {
fs.writeFile("./true.jpg", response.data, function (err) {
if (err) throw new Error("error: " + err.message)
Tesseract.recognize("./true.jpg", "eng").then((result) => {
fs.rmSync("./true.jpg")
fs.rmSync("./eng.traineddata")
resolve(Boolean(result.data.text))
})
})
})
})
} Of course, now the user would use it like this: const t = require('true')
(async function() {
var myTrueValue = await t()
console.log(myTrueValue) // true
})() or this
|
what if the name of the boolean value of |
If the ES standard is updated and "true" is changed to another keyword (such as yea, yes, or affirmative) it would break this library. Instead of returning true could we return (1==1)?
The text was updated successfully, but these errors were encountered: