Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #20210 > unrolled thread

multi-line Strings

Started bybob smith <bob@coolfone.comze.com>
First post2012-12-10 08:22 -0800
Last post2012-12-29 18:18 +0100
Articles 20 on this page of 146 — 22 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  multi-line Strings bob smith <bob@coolfone.comze.com> - 2012-12-10 08:22 -0800
    Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 11:43 -0500
      Re: multi-line Strings Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-10 09:36 -0800
      Re: multi-line Strings markspace <-@.> - 2012-12-10 09:42 -0800
        Re: multi-line Strings Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-10 09:51 -0800
          Re: multi-line Strings markspace <-@.> - 2012-12-10 10:27 -0800
            Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-10 13:43 -0500
              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 15:08 -0500
                Re: multi-line Strings markspace <-@.> - 2012-12-10 13:05 -0800
                Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-10 16:22 -0500
                  Re: multi-line Strings markspace <-@.> - 2012-12-10 13:36 -0800
                  Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 16:52 -0500
                    Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-10 18:04 -0500
                      Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 00:17 +0000
                        Re: multi-line Strings markspace <-@.> - 2012-12-10 17:35 -0800
                          Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 01:56 +0000
                            Re: multi-line Strings markspace <-@.> - 2012-12-10 18:00 -0800
                              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 21:16 -0500
                                Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 22:21 +0000
                              Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-10 22:12 -0600
                            Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-11 05:01 -0400
                              Re: multi-line Strings markspace <-@.> - 2012-12-11 09:46 -0800
                                Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 22:26 +0000
                              Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-11 16:25 -0600
                        Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 21:10 -0500
                          Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 22:31 +0000
                            Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:30 -0500
                              Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-15 03:35 -0600
                              Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-15 11:54 +0000
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-15 08:53 -0500
                                Re: multi-line Strings Jim Janney <jjanney@shell.xmission.com> - 2012-12-16 12:19 -0700
                                  Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-18 13:24 +0000
                                Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-16 17:21 -0800
                                  Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-18 14:03 +0000
                                    Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-18 09:05 -0800
                                Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-17 20:13 -0400
                                  Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-18 13:38 +0000
                                    Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-19 19:48 -0400
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 21:07 -0500
                                  Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-19 08:26 -0600
                                    Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 16:36 -0500
                                      Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-21 12:51 -0600
                                        Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-21 14:05 -0600
                              Re: multi-line Strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2012-12-15 18:22 +0100
                                Re: multi-line Strings Robert Klemme <shortcutter@googlemail.com> - 2012-12-16 00:34 +0100
                                  Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-16 02:56 -0600
                                    Re: multi-line Strings Robert Klemme <shortcutter@googlemail.com> - 2012-12-16 14:07 +0100
                                      Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-16 13:44 -0600
                                  Re: multi-line Strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2012-12-16 17:43 +0100
                                    Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:37 -0500
                        Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-10 22:03 -0600
                        Re: multi-line Strings Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-11 10:43 -0600
                          Re: multi-line Strings Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-11 22:44 +0000
                      Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-10 21:09 -0500
        Re: multi-line Strings Sebastian <sebastian@undisclosed.invalid> - 2012-12-12 10:40 +0100
          Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-12 20:28 -0500
      Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-10 13:42 -0600
    Re: multi-line Strings "William Bonawentura" <nie@ma.mnie.pl> - 2012-12-11 07:58 +0100
      Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-11 10:08 -0500
        Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-11 09:41 -0600
        Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-11 15:02 -0600
          Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:27 -0500
          Re: multi-line Strings Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-14 23:23 -0600
            Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-15 02:56 -0600
      Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-11 16:31 -0500
        Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-11 17:07 -0600
          Re: multi-line Strings Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-11 15:31 -0800
            Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-11 19:41 -0600
        Re: multi-line Strings "William Bonawentura" <nie@ma.mnie.pl> - 2012-12-13 07:43 +0100
          Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-12 23:09 -0800
          Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-13 06:34 -0400
            Re: multi-line Strings "William Bonawentura" <nie@ma.mnie.pl> - 2012-12-14 07:35 +0100
              Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-14 02:44 -0600
                Re: multi-line Strings "William Bonawentura" <nie@ma.mnie.pl> - 2012-12-14 11:48 +0100
                  Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-14 05:10 -0600
                  Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-14 15:18 -0800
                  Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:16 -0500
              Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-14 05:55 -0400
                Re: multi-line Strings "William Bonawentura" <nie@ma.mnie.pl> - 2012-12-14 11:50 +0100
                  Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-14 05:12 -0600
                  Re: multi-line Strings Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-14 11:24 -0800
                    Re: multi-line Strings markspace <-@.> - 2012-12-14 11:47 -0800
                      Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-14 12:26 -0800
                        Re: multi-line Strings markspace <-@.> - 2012-12-14 12:53 -0800
                          Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:36 -0500
                            Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-15 12:06 +0000
                              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:23 -0500
                            Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-15 08:16 -0600
                              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:24 -0500
                            Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-15 13:36 -0800
                          Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-16 17:36 -0800
                      Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-14 12:30 -0800
                        Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:43 -0500
                      Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-14 17:36 -0500
                        Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:46 -0500
                          Re: multi-line Strings BGB <cr88192@hotmail.com> - 2012-12-16 04:29 -0600
                      Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-17 20:45 -0400
                        Re: multi-line Strings Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-17 17:11 -0800
                          Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-17 20:25 -0500
                            Re: multi-line Strings Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-17 18:13 -0800
                              Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-18 06:34 -0400
                                Re: multi-line Strings Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-18 10:54 -0800
                                  Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-18 18:57 -0400
                                    Re: multi-line Strings Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 20:02 -0500
                                      Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-18 17:13 -0800
                                    Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:35 -0500
                                  Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-18 15:12 -0800
                                    Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-19 10:00 -0800
                                  Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:31 -0500
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:29 -0500
                                  Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-19 20:44 -0400
                                    Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 21:50 -0500
                                      Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-19 23:15 -0800
                                      Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-20 06:00 -0400
                                  Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-20 08:56 -0800
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:33 -0500
                            Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:43 -0500
                              Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-17 22:09 -0600
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:59 -0500
                              Re: multi-line Strings "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-18 13:22 +0000
                                Re: multi-line Strings Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-18 07:52 -0600
                                  Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:58 -0500
                                Re: multi-line Strings Gene Wirchenko <genew@telus.net> - 2012-12-18 09:10 -0800
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:56 -0500
                              Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-18 19:05 -0400
                                Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:42 -0500
                            Re: multi-line Strings Jim Janney <jjanney@shell.xmission.com> - 2012-12-17 22:18 -0700
                          Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:46 -0500
                            Re: multi-line Strings Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-17 21:01 -0800
                              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:46 -0500
                        Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:51 -0500
                          Re: multi-line Strings Patricia Shanahan <pats@acm.org> - 2012-12-17 19:41 -0800
                          Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-18 19:19 -0400
                            Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:50 -0500
                              Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-19 05:23 -0400
                                Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-19 13:25 -0800
              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:14 -0500
              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:14 -0500
            Re: multi-line Strings Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-12-14 23:43 +0200
              Re: multi-line Strings Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 22:20 -0500
                Re: multi-line Strings Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-12-17 20:47 -0400
    Re: multi-line Strings Jim Janney <jjanney@shell.xmission.com> - 2012-12-12 08:33 -0700
      Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-12 11:32 -0800
        Re: multi-line Strings markspace <-@.> - 2012-12-12 11:45 -0800
    Re: multi-line Strings Lew <lewbloch@gmail.com> - 2012-12-15 13:33 -0800
      Re: multi-line Strings Sven Köhler <remove-sven.koehler@gmail.com> - 2012-12-29 18:18 +0100

Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →


#20210 — multi-line Strings

Frombob smith <bob@coolfone.comze.com>
Date2012-12-10 08:22 -0800
Subjectmulti-line Strings
Message-ID<7f36342c-2331-4484-874b-4a0f8953f160@googlegroups.com>
Should something be added to the Java language to make multi-line Strings more clear?

Maybe like what PHP has?

Right now, I have a mess like this:

    private final String mLomoishShader =
            "precision mediump float;\n" +
            "uniform sampler2D tex_sampler_0;\n" +
            "uniform vec2 seed;\n" +
            "uniform float stepsizeX;\n" +
            "uniform float stepsizeY;\n" +
            "uniform float stepsize;\n" +
            "uniform vec2 scale;\n" +
            "uniform float inv_max_dist;\n" +
            "varying vec2 v_texcoord;\n" +
            "float rand(vec2 loc) {\n" +
            "  float theta1 = dot(loc, vec2(0.9898, 0.233));\n" +
            "  float theta2 = dot(loc, vec2(12.0, 78.0));\n" +
            "  float value = cos(theta1) * sin(theta2) + sin(theta1) * cos(theta2);\n" +
            // keep value of part1 in range: (2^-14 to 2^14).
            "  float temp = mod(197.0 * value, 1.0) + value;\n" +
            "  float part1 = mod(220.0 * temp, 1.0) + temp;\n" +
            "  float part2 = value * 0.5453;\n" +
            "  float part3 = cos(theta1 + theta2) * 0.43758;\n" +
            "  return fract(part1 + part2 + part3);\n" +
            "}\n" +
            "void main() {\n" +
            // sharpen
            "  vec3 nbr_color = vec3(0.0, 0.0, 0.0);\n" +
            "  vec2 coord;\n" +
            "  vec4 color = texture2D(tex_sampler_0, v_texcoord);\n" +
            "  coord.x = v_texcoord.x - 0.5 * stepsizeX;\n" +
            "  coord.y = v_texcoord.y - stepsizeY;\n" +
            "  nbr_color += texture2D(tex_sampler_0, coord).rgb - color.rgb;\n" +
            "  coord.x = v_texcoord.x - stepsizeX;\n" +
            "  coord.y = v_texcoord.y + 0.5 * stepsizeY;\n" +
            "  nbr_color += texture2D(tex_sampler_0, coord).rgb - color.rgb;\n" +
            "  coord.x = v_texcoord.x + stepsizeX;\n" +
            "  coord.y = v_texcoord.y - 0.5 * stepsizeY;\n" +
            "  nbr_color += texture2D(tex_sampler_0, coord).rgb - color.rgb;\n" +
            "  coord.x = v_texcoord.x + stepsizeX;\n" +
            "  coord.y = v_texcoord.y + 0.5 * stepsizeY;\n" +
            "  nbr_color += texture2D(tex_sampler_0, coord).rgb - color.rgb;\n" +
            "  vec3 s_color = vec3(color.rgb + 0.3 * nbr_color);\n" +
            // cross process
            "  vec3 c_color = vec3(0.0, 0.0, 0.0);\n" +
            "  float value;\n" +
            "  if (s_color.r < 0.5) {\n" +
            "    value = s_color.r;\n" +
            "  } else {\n" +
            "    value = 1.0 - s_color.r;\n" +
            "  }\n" +
            "  float red = 4.0 * value * value * value;\n" +
            "  if (s_color.r < 0.5) {\n" +
            "    c_color.r = red;\n" +
            "  } else {\n" +
            "    c_color.r = 1.0 - red;\n" +
            "  }\n" +
            "  if (s_color.g < 0.5) {\n" +
            "    value = s_color.g;\n" +
            "  } else {\n" +
            "    value = 1.0 - s_color.g;\n" +
            "  }\n" +
            "  float green = 2.0 * value * value;\n" +
            "  if (s_color.g < 0.5) {\n" +
            "    c_color.g = green;\n" +
            "  } else {\n" +
            "    c_color.g = 1.0 - green;\n" +
            "  }\n" +
            "  c_color.b = s_color.b * 0.5 + 0.25;\n" +
            // blackwhite
            "  float dither = rand(v_texcoord + seed);\n" +
            "  vec3 xform = clamp((c_color.rgb - 0.15) * 1.53846, 0.0, 1.0);\n" +
            "  vec3 temp = clamp((color.rgb + stepsize - 0.15) * 1.53846, 0.0, 1.0);\n" +
            "  vec3 bw_color = clamp(xform + (temp - xform) * (dither - 0.5), 0.0, 1.0);\n" +
            // vignette
            "  coord = v_texcoord - vec2(0.5, 0.5);\n" +
            "  float dist = length(coord * scale);\n" +
            "  float lumen = 0.85 / (1.0 + exp((dist * inv_max_dist - 0.73) * 20.0)) + 0.15;\n" +
            "  gl_FragColor = vec4(bw_color * lumen, color.a);\n" +
            "}\n";

[toc] | [next] | [standalone]


#20211

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-12-10 11:43 -0500
Message-ID<50c61150$0$293$14726298@news.sunsite.dk>
In reply to#20210
On 12/10/2012 11:22 AM, bob smith wrote:
> Should something be added to the Java language to make multi-line Strings more clear?
>
> Maybe like what PHP has?
>
> Right now, I have a mess like this:
>
>      private final String mLomoishShader =
>              "precision mediump float;\n" +
>              "uniform sampler2D tex_sampler_0;\n" +

It could be added.

PHP has it. C# has it.

But I would not consider it a high priority.

It is most useful for demo code.

For real code then large chunks of texts would usually
be stored externally (file, DB etc.) not embedded into
the code.

Arne


[toc] | [prev] | [next] | [standalone]


#20215

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-12-10 09:36 -0800
Message-ID<X4pxs.2950$Id.964@newsfe24.iad>
In reply to#20211
On 12/10/12 8:43 AM, Arne Vajhøj wrote:
> On 12/10/2012 11:22 AM, bob smith wrote:
>> Should something be added to the Java language to make multi-line
>> Strings more clear?
>>
>> Maybe like what PHP has?
>>
>> Right now, I have a mess like this:
>>
>>      private final String mLomoishShader =
>>              "precision mediump float;\n" +
>>              "uniform sampler2D tex_sampler_0;\n" +
>
> It could be added.
>
> PHP has it. C# has it.
>
> But I would not consider it a high priority.
>
> It is most useful for demo code.
>
> For real code then large chunks of texts would usually
> be stored externally (file, DB etc.) not embedded into
> the code.
+1
That definitely looks like it should be in a separate file.  If the 
shader is closely related to the class which contains that declaration, 
I would look into using Class.getResourceAsStream() to load it.

If the class itself can be made to use any shader, I would externalize 
it entirely, passing the shader text as a construction parameter perhaps.

[toc] | [prev] | [next] | [standalone]


#20216

Frommarkspace <-@.>
Date2012-12-10 09:42 -0800
Message-ID<ka56u9$5fk$1@dont-email.me>
In reply to#20211
On 12/10/2012 8:43 AM, Arne Vajhøj wrote:

> It could be added....
>
> But I would not consider it a high priority.
>
> It is most useful for demo code.
>
> For real code then large chunks of texts would usually
> be stored externally (file, DB etc.) not embedded into
> the code.

I agree.  I was going to suggest that bob use a resource, in fact, which 
is of course an external file.

<http://docs.oracle.com/javase/7/docs/technotes/guides/lang/resources.html#class>

I think what I'd like more than multi-line support is support for 
strings without escape sequences.  Like:

   String regex = """\s[0-9](\.|\*)[_a-zA-Z]\w""";

is a lot more readable than trying to mentally decode all of the double 
slashes that regex in Java frequently requires.

(That regex does nothing useful, btw;  it's just an example.)

[toc] | [prev] | [next] | [standalone]


#20218

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-12-10 09:51 -0800
Message-ID<jipxs.2271$fh5.1713@newsfe26.iad>
In reply to#20216
On 12/10/12 9:42 AM, markspace wrote:
> On 12/10/2012 8:43 AM, Arne Vajhøj wrote:
>
>> It could be added....
>>
>> But I would not consider it a high priority.
>>
>> It is most useful for demo code.
>>
>> For real code then large chunks of texts would usually
>> be stored externally (file, DB etc.) not embedded into
>> the code.
>
> I agree.  I was going to suggest that bob use a resource, in fact, which
> is of course an external file.
>
> <http://docs.oracle.com/javase/7/docs/technotes/guides/lang/resources.html#class>
>
>
> I think what I'd like more than multi-line support is support for
> strings without escape sequences.  Like:
>
>    String regex = """\s[0-9](\.|\*)[_a-zA-Z]\w""";
>
> is a lot more readable than trying to mentally decode all of the double
> slashes that regex in Java frequently requires.
>
> (That regex does nothing useful, btw;  it's just an example.)
IntelliJ IDEA actually has a way to open just the expression in its own 
edit window. The expression in the edit window is in the expression 
language (regex in this case), so no Java escaping is necessary.  You 
can then modify it, and IDEA will add the appropriate escaping back in.

They support this for many languages in many contexts. Its a pretty 
nifty feature IMHO.

[toc] | [prev] | [next] | [standalone]


#20219

Frommarkspace <-@.>
Date2012-12-10 10:27 -0800
Message-ID<ka59ij$m8t$1@dont-email.me>
In reply to#20218
On 12/10/2012 9:51 AM, Daniel Pitts wrote:

> IntelliJ IDEA actually has a way to open just the expression in its own
> edit window.


That is indeed a nifty feature.  However I believe in principle a 
programming language should be readable without something having to 
translate it for you.  Java regex fails that test often enough where I 
think a non-escaped string constant would be a benefit overall.

[toc] | [prev] | [next] | [standalone]


#20220

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2012-12-10 13:43 -0500
Message-ID<ka5afr$trm$1@dont-email.me>
In reply to#20219
On 12/10/2012 1:27 PM, markspace wrote:
> On 12/10/2012 9:51 AM, Daniel Pitts wrote:
>
>> IntelliJ IDEA actually has a way to open just the expression in its own
>> edit window.
>
>
> That is indeed a nifty feature.  However I believe in principle a
> programming language should be readable without something having to
> translate it for you.  Java regex fails that test often enough where I
> think a non-escaped string constant would be a benefit overall.

     FORTRAN solved this problem half a century ago:

	5HHELLO
	  ^^^^^
	  here's the string

	13HHELLO, WORLD.
	   ^^^^^^^^^^^^^
	   here's the string

	3H1233H456
	  ^^^  ^^^
	  here are the strings

	8H1233H456
	  ^^^^^^^^
	  here's the string

	12H  1233H456
	   ^^^^^^^^^^^^
	   here's the string

There was, of course, a certain amount of tedium (not to mention
opportunity for error) in manually counting each string, but if
Those Thrilling Days Of Yesteryear are what you crave ...

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#20223

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-12-10 15:08 -0500
Message-ID<50c6413a$0$293$14726298@news.sunsite.dk>
In reply to#20220
On 12/10/2012 1:43 PM, Eric Sosman wrote:
> On 12/10/2012 1:27 PM, markspace wrote:
>> On 12/10/2012 9:51 AM, Daniel Pitts wrote:
>>> IntelliJ IDEA actually has a way to open just the expression in its own
>>> edit window.
>>
>> That is indeed a nifty feature.  However I believe in principle a
>> programming language should be readable without something having to
>> translate it for you.  Java regex fails that test often enough where I
>> think a non-escaped string constant would be a benefit overall.
>
>      FORTRAN solved this problem half a century ago:
>
>      5HHELLO
>        ^^^^^
>        here's the string
>
>      13HHELLO, WORLD.
>         ^^^^^^^^^^^^^
>         here's the string
>
>      3H1233H456
>        ^^^  ^^^
>        here are the strings
>
>      8H1233H456
>        ^^^^^^^^
>        here's the string
>
>      12H  1233H456
>         ^^^^^^^^^^^^
>         here's the string
>
> There was, of course, a certain amount of tedium (not to mention
> opportunity for error) in manually counting each string, but if
> Those Thrilling Days Of Yesteryear are what you crave ...

If Java was going to implement it, then I think the C# way
would be preferably to the Fortran way.

Arne

PS: And for those that do not know C#, then C# has "" strings
     with \ as escape like Java, but also has @"" string where
     \ is not an escape and where line change are allowed.



[toc] | [prev] | [next] | [standalone]


#20227

Frommarkspace <-@.>
Date2012-12-10 13:05 -0800
Message-ID<ka5ir7$m9m$1@dont-email.me>
In reply to#20223
On 12/10/2012 12:08 PM, Arne Vajhøj wrote:

> PS: And for those that do not know C#, then C# has "" strings
>      with \ as escape like Java, but also has @"" string where
>      \ is not an escape and where line change are allowed.


And that's what I was trying to imply with my triple quotes.  I don't 
know C# so I'm not aware of their syntax conventions.  However, anything 
at all works for me, as long as it's readable.  (Manually counting the 
characters in a string, not so much.)

[toc] | [prev] | [next] | [standalone]


#20229

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2012-12-10 16:22 -0500
Message-ID<ka5jq4$tj7$1@dont-email.me>
In reply to#20223
On 12/10/2012 3:08 PM, Arne Vajhøj wrote:
>[...]
> PS: And for those that do not know C#, then C# has "" strings
>      with \ as escape like Java, but also has @"" string where
>      \ is not an escape and where line change are allowed.

     As one of "those," and curious: Can a @"" string have an
embedded " character?

	@""Escapes? We don' need no steenkin' escapes!" he snarled."

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#20230

Frommarkspace <-@.>
Date2012-12-10 13:36 -0800
Message-ID<ka5klh$3or$1@dont-email.me>
In reply to#20229
On 12/10/2012 1:22 PM, Eric Sosman wrote:
> On 12/10/2012 3:08 PM, Arne Vajhøj wrote:
>> [...]
>> PS: And for those that do not know C#, then C# has "" strings
>>      with \ as escape like Java, but also has @"" string where
>>      \ is not an escape and where line change are allowed.
>
>      As one of "those," and curious: Can a @"" string have an
> embedded " character?
>
>      @""Escapes? We don' need no steenkin' escapes!" he snarled."

That's why I like triple quotes.  Single and double embedded quotes are 
ok.  In fact I'd provide an alternate syntax that harkened back to the 
Unix shell 'here document':

  String s = <<< ident """A string with "s in it.""" ident <<<;

Now you can adapt the closing delimiter so it doesn't duplicate any 
substring portion of your constant.  No escapes are ever required this 
way.  Even triple quotes can be embedded arbitrarily.





[toc] | [prev] | [next] | [standalone]


#20231

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-12-10 16:52 -0500
Message-ID<50c6598d$0$290$14726298@news.sunsite.dk>
In reply to#20229
On 12/10/2012 4:22 PM, Eric Sosman wrote:
> On 12/10/2012 3:08 PM, Arne Vajhøj wrote:
>> [...]
>> PS: And for those that do not know C#, then C# has "" strings
>>      with \ as escape like Java, but also has @"" string where
>>      \ is not an escape and where line change are allowed.
>
>      As one of "those," and curious: Can a @"" string have an
> embedded " character?

Yes.

An " inside @"" is encoded as "".

Arne

[toc] | [prev] | [next] | [standalone]


#20233

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2012-12-10 18:04 -0500
Message-ID<ka5pq4$5ao$1@dont-email.me>
In reply to#20231
On 12/10/2012 4:52 PM, Arne Vajhøj wrote:
> On 12/10/2012 4:22 PM, Eric Sosman wrote:
>> On 12/10/2012 3:08 PM, Arne Vajhøj wrote:
>>> [...]
>>> PS: And for those that do not know C#, then C# has "" strings
>>>      with \ as escape like Java, but also has @"" string where
>>>      \ is not an escape and where line change are allowed.
>>
>>      As one of "those," and curious: Can a @"" string have an
>> embedded " character?
>
> Yes.
>
> An " inside @"" is encoded as "".

     Aha!  Another FORTRAN legacy!  As of FORTRAN IV you could
write 'I''M HERE' instead of 8HI'M HERE, which most people
considered a great advance -- in the late 1960's.

     My point, of course, is that there's still an escape mechanism
at work.  It's a different mechanism, yes, but it still has the
What You See Ain't What You Get problem this thread has been
complaining about.  And here's a funny thing about inventing an
escape mechanism: Even if the special character sequences were
surpassingly uninteresting and spectacularly rare before being
adopted as escapes, their very adoption makes them suddenly
interesting and much more common.  You'll find yourself wanting
to write a regex that looks for "" inside a @"..." string, and
you'll get something like

	@"@""([^""]*""""")*[^""]*"""

... leaving you pretty much where you started, just with a new
suit of clothes on the Emperor.  Also, we still need to produce

	"\u0281 is the IPA voiced uvular fricative"

... on input systems that cannot generate the IPA voiced uvular
fricative all by themselves.

     Source has syntax -- at this level we usually speak of "lexing,"
but a lexer is really just a parser optimized to recognize a simple
syntax.  A big job of the lexer is to distinguish metacharacters
from payload characters, and if every character could potentially
appear as payload there has to be some kind of convention to
discriminate the different usages.  Those conventions mean that
WYSAWYG will inevitably occur, to a greater extent or a lesser.

     It's unfortunate that both Java and regex use \ so heavily,
because it leads to a lot of escaping-of-escapes and harms
readability.  But why should it be a given that Java's literals
should be different to avoid conflict with regex syntax?  Why
not change the regex syntax instead, and use, say, ~ for the
role now taken by \?  It might improve regexes to the point
where they're merely unreadable, instead of intolerable.  ;-)

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#20234

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2012-12-11 00:17 +0000
Message-ID<ka5u2o$h19$1@localhost.localdomain>
In reply to#20233
On Mon, 10 Dec 2012 18:04:33 -0500, Eric Sosman wrote:


>      It's unfortunate that both Java and regex use \ so heavily,
> because it leads to a lot of escaping-of-escapes and harms readability. 
> But why should it be a given that Java's literals should be different to
> avoid conflict with regex syntax?  Why not change the regex syntax
> instead, and use, say, ~ for the role now taken by \?  It might improve
> regexes to the point where they're merely unreadable, instead of
> intolerable.  ;-)

I've always liked the Awk and Perl default convention of delimiting 
regexes with slashes: /regex/ - if their compilers can deal with this 
cleanly, the Java compiler could surely do the same.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#20237

Frommarkspace <-@.>
Date2012-12-10 17:35 -0800
Message-ID<ka62lb$mub$1@dont-email.me>
In reply to#20234
On 12/10/2012 4:17 PM, Martin Gregorie wrote:
> I've always liked the Awk and Perl default convention of delimiting
> regexes with slashes: /regex/ - if their compilers can deal with this
> cleanly, the Java compiler could surely do the same.

Perl, especially, and "cleanly" don't belong in the same sentence.  Or 
paragraph.  Or solar system.

[toc] | [prev] | [next] | [standalone]


#20238

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2012-12-11 01:56 +0000
Message-ID<ka63rv$ib4$1@localhost.localdomain>
In reply to#20237
On Mon, 10 Dec 2012 17:35:37 -0800, markspace wrote:

> On 12/10/2012 4:17 PM, Martin Gregorie wrote:
>> I've always liked the Awk and Perl default convention of delimiting
>> regexes with slashes: /regex/ - if their compilers can deal with this
>> cleanly, the Java compiler could surely do the same.
> 
> Perl, especially, and "cleanly" don't belong in the same sentence.  Or
> paragraph.  Or solar system.
>
Yes, couldn't agree more. The only languages I've used that approach the 
ugliness of Perl are Python (its object construction and handling are 
every bit as nasty as Perls) and RPG II (designing an HLL to look exactly 
like a fixed field assembler is just plain perverse). 

I'll use awk+bash in preference to Perl any day. However, Perl almost 
certainly inherited its use of /regex/ delimiters from awk, which is a 
fairly elegant and minimal scripting system and I do like those 
delimiters.

Don't forget that Perl, in its earliest form, was very obviously built by 
mashing together a lot of Bourn Shell syntax with bits nicked from awk 
and sed and completed by shovelling in the most useful bits of several 
small UNIX utilities. Larry Wall has always acknowledged that as being 
its origin. Its got a bit more structured and usable since then, but IMO 
its still damned ugly. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#20239

Frommarkspace <-@.>
Date2012-12-10 18:00 -0800
Message-ID<ka644m$uh5$1@dont-email.me>
In reply to#20238
On 12/10/2012 5:56 PM, Martin Gregorie wrote:
>
> Yes, couldn't agree more. The only languages I've used that approach the
> ugliness of Perl are Python (its object construction and handling are
>
>

Good, it's not just me that dislikes Python.

[toc] | [prev] | [next] | [standalone]


#20242

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-12-10 21:16 -0500
Message-ID<50c6976d$0$283$14726298@news.sunsite.dk>
In reply to#20239
On 12/10/2012 9:00 PM, markspace wrote:
> On 12/10/2012 5:56 PM, Martin Gregorie wrote:
>> Yes, couldn't agree more. The only languages I've used that approach the
>> ugliness of Perl are Python (its object construction and handling are
>
> Good, it's not just me that dislikes Python.

There are probably thousands and thousands.

But I am not among them. I think Python is OK. I would
not use it for the same tasks as Java, but still.

Arne

[toc] | [prev] | [next] | [standalone]


#20259

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2012-12-11 22:21 +0000
Message-ID<ka8bkr$68v$1@localhost.localdomain>
In reply to#20242
On Mon, 10 Dec 2012 21:16:14 -0500, Arne Vajhøj wrote:

> But I am not among them. I think Python is OK. I would not use it for
> the same tasks as Java, but still.
>
Its more or less OK. In its favour is a good compiler/interpreter: almost 
as good as awk when it comes to diagnostics and very much better in this 
respect than Perl or js. There are really three things I don't like about 
it:

- the aforementioned ugly pointerised object syntax
- the reversal of the meaning of 'self' compared with Java and, IIRC, C++
- the poor backward compatibility with previous versions of Python.
  
I haven't used it enough to run into backward compatibility problems, but 
from general programmers chatter about it, it seems that the syntax and 
support library differences between v2.7 and 3.0 (and between 2.4 and 
2.7) appear to be quite a problem. 

This seems to be about the worst case of discontinuity within a language 
that I can recall since COBOL upgrades in the early/mid '80s, but at 
least it was *only* the language because COBOL has no standard library to 
speak of. There was a huge C discontinuity between K&R C and ANSI C, but 
at least the modern compilers will still compile K&R programs and the 
standard library mostly still works with old programs.

This is something that Java has managed very well: I haven't used it 
nearly as long as some of you here, but I've yet to revisit any of my 
older code and find that it refused to compile and run. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#20246

FromBGB <cr88192@hotmail.com>
Date2012-12-10 22:12 -0600
Message-ID<ka6c11$m0d$1@news.albasani.net>
In reply to#20239
On 12/10/2012 8:00 PM, markspace wrote:
> On 12/10/2012 5:56 PM, Martin Gregorie wrote:
>>
>> Yes, couldn't agree more. The only languages I've used that approach the
>> ugliness of Perl are Python (its object construction and handling are
>>
>>
>
> Good, it's not just me that dislikes Python.
>
>

I am not so fond of Python either...

but, to each his own...


WRT scripting, many people like Python, many others prefer Lua, and I 
myself, prefer my own obscure ECMAScript-based language, and, elsewhere, 
I have seen plenty of people hate on ECMAScript and friends (JavaScript 
and ActionScript) as well...

or such...

[toc] | [prev] | [next] | [standalone]


Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web