Constant request: #LOREM$

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB Fanatic
User
User
Posts: 49
Joined: Wed Dec 17, 2014 11:54 am

Constant request: #LOREM$

Post 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. ;)
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Constant request: #LOREM$

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
PB Fanatic
User
User
Posts: 49
Joined: Wed Dec 17, 2014 11:54 am

Re: Constant request: #LOREM$

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Constant request: #LOREM$

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Constant request: #LOREM$

Post 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 )
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Constant request: #LOREM$

Post 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)
PB Fanatic
User
User
Posts: 49
Joined: Wed Dec 17, 2014 11:54 am

Re: Constant request: #LOREM$

Post 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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Constant request: #LOREM$

Post 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...
BERESHEIT
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Constant request: #LOREM$

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
blueb
Addict
Addict
Posts: 1044
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Constant request: #LOREM$

Post 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:
- It was too lonely at the top.

System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
PB Fanatic
User
User
Posts: 49
Joined: Wed Dec 17, 2014 11:54 am

Re: Constant request: #LOREM$

Post 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
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Constant request: #LOREM$

Post 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.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: Constant request: #LOREM$

Post 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))
Keep it BASIC.
User avatar
skywalk
Addict
Addict
Posts: 3997
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Constant request: #LOREM$

Post 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".
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Constant request: #LOREM$

Post 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......
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply