Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30175
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: convert a string into a json object, |
| Date | 2016-04-02 01:18 +0200 |
| Organization | albasani.net |
| Message-ID | <ndmvkt$8lq$1@news.albasani.net> (permalink) |
| References | <c8134afb-b7f5-4e2d-b3e6-90f8a3594544@googlegroups.com> <json-20160401033220@ram.dialup.fu-berlin.de> <ndlcms$ae5$1@news.albasani.net> <style-20160401174212@ram.dialup.fu-berlin.de> |
Stefan Ram wrote: > Stefan Weiss <krewecherl@gmail.com> writes: >>> for( let i = 0; i < 3; ++i ) >> Hard-coding number of records... > > What needs to be hard-coded depends on the specification of > the problem. In the case of this thread, no other > specification than the source code was given. The source > code contained this /fixed/ string constant »'Janis...«. > There also is YAGNI and > c2.com/cgi-bin/wiki?DoTheSimplestThingThatCouldPossiblyWork. YAGNI is my secret Achilles heel :/ I'm always trying to read between the lines and anticipate the actual requirements instead of what was explicitly asked. I've written and deleted thousands of lines of code for this reason. >> Off-topic... does anymody else find it counter-intuitive when most of the >> variables are declared as "const"? I've seen this style recently in many >> places, and it's technically correct, but for some reason I find it irritating. > > These /are/ constants because they are not assigned to after > their initializations. I deem it most readable to declare > constants with »const« and not with »let«. Because it /is/ > a constant, it also should be /declared/ to be a constant. I know, they are technically constants. But the semantics seem off to me... I can't really explain this properly. In other languages, I would use `const` or `#define` (etc) to indicate a value that will be used literally throughout the rest of the program. Any reference to the constant can be replaced by its value. Declaring a `const` only for the duration of a single loop iteration just doesn't seem "right". - stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-03-31 19:12 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-01 10:42 +0200
Re: convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-04-01 17:32 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-01 10:49 +0200
Re: convert a string into a json object, John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-01 19:21 +0100
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-01 16:21 -0300
Re: convert a string into a json object, Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-01 20:36 +0100
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 04:07 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 12:07 -0300
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 17:36 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 21:01 -0300
Re: convert a string into a json object, Scott Sauyet <scott@sauyet.com> - 2016-04-02 20:40 +0000
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-02 01:18 +0200
Re: convert a string into a json object, John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-02 11:29 +0100
Re: convert a string into a json object, Scott Sauyet <scott@sauyet.com> - 2016-04-02 20:30 +0000
Re: convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-04-01 11:32 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-02 00:51 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 12:03 -0300
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 03:48 +0200
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 04:25 +0200
csiph-web