Page 1 of 2

Constant request: #LOREM$

Posted: Sun Dec 21, 2014 1:43 pm
by PB Fanatic
Quite often we need to display a block of text when testing code, such as in a TextGadget. Rather than building a string manually for our tests, I'd like to see a new constant added called #LOREM$ which holds this public-domain text:

Code: Select all

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Source: http://en.wikipedia.org/wiki/Lorem_ipsum

Then we can easily test things like this, without needing to build a big string:

Code: Select all

OpenWindow(0,0,0,0,0,"")
TextGadget(0,0,0,0,0,#LOREM$)
Such an easy, free and quick addition to add to the compiler. ;)

Re: Constant request: #LOREM$

Posted: Sun Dec 21, 2014 1:51 pm
by TI-994A
PB Fanatic wrote:Such an easy, free and quick addition to add to the compiler. ;)
With all due respect, it is just as easy, free and quick to include it manually.

IMHO, it would be a frivolous feature. :wink:

Re: Constant request: #LOREM$

Posted: Sun Dec 21, 2014 2:11 pm
by PB Fanatic
But we've got #DOUBLEQUOTE$ when we could quickly, freely, easily and manually type Chr(34) instead, which is even shorter than typing #DOUBLEQUOTE$. ;)

So, for a long block of test text, #LOREM$ would be awesome, because no, it's not quicker to type a long block manually instead of just 7 characters. Unless you type like Superman? :lol:
TI-994A wrote:IMHO, it would be a frivolous feature. :wink:
That's okay, you would've have to use it. ;) Let others like myself enjoy it.

Re: Constant request: #LOREM$

Posted: Sun Dec 21, 2014 4:11 pm
by TI-994A
PB Fanatic wrote:But we've got #DOUBLEQUOTE$ when we could quickly, freely, easily and manually type Chr(34) instead, which is even shorter than typing #DOUBLEQUOTE$.
Now, ask yourself why there would be a twelve-character constant to represent a two-digit ASCII code.

Take your time. :lol:

Re: Constant request: #LOREM$

Posted: Sun Dec 21, 2014 4:34 pm
by Danilo
Fred should add #DQ and #DQ$, I simply forgot to add them (over 10 years ago).

Code: Select all

Debug #DOUBLEQUOTE$
Debug #DQUOTE$

#DQ$ = #DQUOTE$
#DQ  = 34

Debug #DQ
Debug #DQ$
Debug Chr( #DQ )

Re: Constant request: #LOREM$

Posted: Sun Dec 21, 2014 5:38 pm
by Tenaja
TI-994A wrote:
PB Fanatic wrote:But we've got #DOUBLEQUOTE$ when we could quickly, freely, easily and manually type Chr(34) instead, which is even shorter than typing #DOUBLEQUOTE$.
Now, ask yourself why there would be a twelve-character constant to represent a two-digit ASCII code.

Take your time. :lol:
because this will NOT work:

Code: Select all

Macro dq(x)
	" + x + "
EndMacro
Debug dq("hello")
but this will:

Code: Select all

Macro adddq(x)
	#DOUBLEQUOTE$ + x + #DOUBLEQUOTE$
EndMacro

Debug adddq("hello")
And with autofill, that is much faster than using chr(34)

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 9:44 am
by PB Fanatic
TI-994A wrote:ask yourself why there would be a twelve-character constant to represent a two-digit ASCII code.
That doesn't make sense. It's quicker to type Chr(34) than #DOUBLEQUOTE$, you agree? So, my thinking is that typing a long constant to replace Chr(34) is just silly, but being able to type #LOREM$ instead of:

Code: Select all

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
to get a large block of random text (for testing) makes absolute perfect sense.

So, no, I don't get your point. I've taken my time but don't get it.

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 10:13 am
by netmaestro
to get a large block of random text (for testing) makes absolute perfect sense
Does it make sense? Sure it does. Will it happen within 7 years? No, too many other things have priority. When the dev team has the time to add stuff like this to the language, we really will have arrived. Reclining on the beach, sipping margaritas and watching Apple Microsoft and Symantec straining to catch up. PureOS is on 78% of devices, Fred has just bought Hawaii and anyone with a PB license can vacation as Fantaisie's guest anytime. Ahh...

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 11:10 am
by TI-994A
PB Fanatic wrote:It's quicker to type Chr(34) than #DOUBLEQUOTE$, you agree?
Sorry, but I don't.
1. Not when the AutoComplete feature is enabled.
2. Not when you use its counterpart, #DQUOTE$.
3. Not when you have to look it up, which is the case with novice programmers.
PB Fanatic wrote:I've taken my time but don't get it.
You should've taken a little more.
1. For its utility: the double quote cannot be utilised as a string literal.
2. For its verbosity: #DOUBLEQUOTE$ is easier to remember than Chr(34).
3. By the very same logic, constants such as #CR$, #LF$, #TAB$ have also been included.

A constant such as #LOREM$ just doesn't fit the bill. :wink:

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 1:01 pm
by blueb
PB Fanatic wrote:Quite often we need to display a block of text when testing code, such as in a TextGadget. Rather than building a string manually for our tests, I'd like to see a new constant added called #LOREM$ which holds this public-domain text:

Such an easy, free and quick addition to add to the compiler. ;)
Well... an easy compromise could be to create a template called:
LOREM$ which contains your text, and use it whenever you wish. :wink:

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 1:16 pm
by PB Fanatic
blueb wrote:Well... an easy compromise could be to create a template called:
LOREM$ which contains your text, and use it whenever you wish. :wink:
I'm talking about when sharing code in these forums, too. If I wanted to demonstrate how to do something with a big string, it's quicker and easier to have #LOREM$ in the code instead of building up a big string, like was done here: http://www.purebasic.fr/english/viewtop ... 12&t=61279

Anyway, maybe the devs will read this thread and agree; maybe not. I think it's a good idea, but then I'm a newbie here. :P

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 4:20 pm
by Tenaja
netmaestro wrote:
to get a large block of random text (for testing) makes absolute perfect sense
Does it make sense? Sure it does. Will it happen within 7 years? No, too many other things have priority. When the dev team has the time to add stuff like this to the language, we really will have arrived. Reclining on the beach, sipping margaritas and watching Apple Microsoft and Symantec straining to catch up. PureOS is on 78% of devices, Fred has just bought Hawaii and anyone with a PB license can vacation as Fantaisie's guest anytime. Ahh...
I cannot imagine the implementation taking any longer than a copy/paste, perhaps two or three additional keystrokes... if it takes longer than that, then he has set up constants with a convoluted implementation.

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 4:39 pm
by heartbone
PB Fanatic wrote:Quite often we need to display a block of text when testing code, such as in a TextGadget. Rather than building a string manually for our tests, I'd like to see a new constant added called #LOREM$ which holds this public-domain text:

Code: Select all

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Source: http://en.wikipedia.org/wiki/Lorem_ipsum

Then we can easily test things like this, without needing to build a big string:

Code: Select all

OpenWindow(0,0,0,0,0,"")
TextGadget(0,0,0,0,0,#LOREM$)
Such an easy, free and quick addition to add to the compiler. ;)
PB Fanatic wrote:
TI-994A wrote:ask yourself why there would be a twelve-character constant to represent a two-digit ASCII code.
That doesn't make sense. It's quicker to type Chr(34) than #DOUBLEQUOTE$, you agree? So, my thinking is that typing a long constant to replace Chr(34) is just silly, but being able to type #LOREM$ instead of:

Code: Select all

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
to get a large block of random text (for testing) makes absolute perfect sense.
Absolute perfect? :lol:
That block of text isn't random, so if that's the functionality that you are now using for justification for this request, wouldn't a procedure to generate a somewhat random ASCII string be better suited?

Code: Select all

OpenWindow(0,0,0,0,0,"")
TextGadget(0,0,0,0,0,GarbageText(437))
Or if you don't need exactly 437 characters, how about?...

Code: Select all

OpenWindow(0,0,0,0,0,"")
TextGadget(0,0,0,0,0,GarbageText(Random(65534)+1))

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 4:49 pm
by skywalk
There is merit to this request with respect to example code found in the documentation and the forum. While "Hello World!" is easy enough to pass around, long texts that include line feeds to illustrate editor and string gadgets or whatever gadget would benefit from standardization. The same goes for simple images which can be found in the install folder, like #PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico".

Re: Constant request: #LOREM$

Posted: Mon Dec 22, 2014 5:14 pm
by IdeasVacuum
..... How about a single .pbi include file, posted as a sticky on the forum? Everybody could update that post so that we have a comprehensive file to support a range of code snippets......