Re: [WebDNA] showif with empty variable

This WebDNA talk-list message is from

2015


It keeps the original formatting.
numero = 112182
interpreted = N
texte = Yeah, I think either works well.. The only thing I=92ll say is =91?=92 in most languages is a ternary = operator=85 which makes it a logical choice for this kind of comparison, = but maybe lessens the =93usual scope=94 of a standardized ternary = operator, when using only for checking if a variable is set or not. I suppose there is a way to widen the scope of your [?] function=85 but = not really needed.. just a thought. :-) Donovan On Mar 14, 2015, at 12:14 PM, Brian Burton wrote: > I like your IsSet, but=85 >=20 > I was amazed when I figured out you could use a single punctuation = mark as a function name so I had to do it. It=92s easy to type (4 less = letters!) and avoids that whole annoying issue when you have to make = your function names international (example: in Canada IsSet becomes = SetEh ) >=20 > A few years ago I learned (and have since mostly forgotten) Ruby on = Rails. The thing that frustrated me most about that language/framework = is how =93magical=94 it is. Code works or doesn=92t work based on it=92s = context. It kind of ruins the readability of the code, because code that = works in one place, won=92t work in another because it=92s out of = context which isn=92t very well documented because DUH, you=92re just = supposed to know how it works (well, that=92s the feeling I got from the = developer community)=20 >=20 > Anyway, [showif [IsSet selector]] vs. [showif [? selector]=3DF]. The = first changes the way people expect to see a showif. The 2nd is more = readable and accessible if someone else has to maintain the codebase = someday. >=20 > Just my two cents, this isn=92t a criticism, I just enjoy open = discussion to find the optimal solution to any given problem :) >=20 > -Brian B. >=20 >=20 >> On Mar 14, 2015, at 11:48 AM, Donovan Brooke wrote: >>=20 >> Nice Brian! we think alike. >>=20 >> On looking at my IsSet function, which is similar to yours..=20 >> I do rather: >> [then]T=3DT[/then] >> [else]T=3DF[/then] >>=20 >> This makes my call look something like this: >>=20 >> [showif [IsSet selector]] >> [include file=3Dblank_page.inc] >> [/showif] >>=20 >> Sincerely, >> Donovan >>=20 >>=20 >>=20 >>=20 >> On Mar 13, 2015, at 7:33 PM, Brian Burton wrote: >>=20 >>> This is what I use >>>=20 >>> [function name=3D?] >>> [!] return T/F based on if a field exists and has a value[/!] >>> [!] incoming variables: the name of the field to be tested i.e. [? = field] [/!] >>> [If = ("[url][interpret][[params_string]][/interpret][/url]"!"%5B[interpret][par= ams_string][/interpret]%5D") & = ("[url][interpret][[params_string]][/interpret][/url]"!"")] >>> [Then][return]T[/return][/Then] >>> [Else][return]F[/return][/Else] >>> [/If] >>> [/function] >>>=20 >>> usage: [showif [? selector]=3DF] [include blank_page.inc] [/showif] >>>=20 >>>=20 >>>=20 >=20 >=20 > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] showif with empty variable (Brian Burton 2015)
  2. Re: [WebDNA] showif with empty variable (Donovan Brooke 2015)
  3. Re: [WebDNA] showif with empty variable (Brian Burton 2015)
  4. Re: [WebDNA] showif with empty variable (Donovan Brooke 2015)
  5. Re: [WebDNA] showif with empty variable (Dan Strong 2015)
  6. Re: [WebDNA] showif with empty variable (Terry Wilson 2015)
  7. Re: [WebDNA] showif with empty variable (Kenneth Grome 2015)
  8. Re: [WebDNA] showif with empty variable (Steve Braun 2015)
  9. Re: [WebDNA] showif with empty variable (Steve Braun 2015)
  10. Re: [WebDNA] showif with empty variable (Kenneth Grome 2015)
  11. Re: [WebDNA] showif with empty variable (Donovan Brooke 2015)
  12. Re: [WebDNA] showif with empty variable (Brian Burton 2015)
  13. Re: [WebDNA] showif with empty variable (Terry Wilson 2015)
  14. Re: [WebDNA] showif with empty variable (Dan Strong 2015)
  15. [WebDNA] showif with empty variable (Steve Braun 2015)
Yeah, I think either works well.. The only thing I=92ll say is =91?=92 in most languages is a ternary = operator=85 which makes it a logical choice for this kind of comparison, = but maybe lessens the =93usual scope=94 of a standardized ternary = operator, when using only for checking if a variable is set or not. I suppose there is a way to widen the scope of your [?] function=85 but = not really needed.. just a thought. :-) Donovan On Mar 14, 2015, at 12:14 PM, Brian Burton wrote: > I like your IsSet, but=85 >=20 > I was amazed when I figured out you could use a single punctuation = mark as a function name so I had to do it. It=92s easy to type (4 less = letters!) and avoids that whole annoying issue when you have to make = your function names international (example: in Canada IsSet becomes = SetEh ) >=20 > A few years ago I learned (and have since mostly forgotten) Ruby on = Rails. The thing that frustrated me most about that language/framework = is how =93magical=94 it is. Code works or doesn=92t work based on it=92s = context. It kind of ruins the readability of the code, because code that = works in one place, won=92t work in another because it=92s out of = context which isn=92t very well documented because DUH, you=92re just = supposed to know how it works (well, that=92s the feeling I got from the = developer community)=20 >=20 > Anyway, [showif [IsSet selector]] vs. [showif [? selector]=3DF]. The = first changes the way people expect to see a showif. The 2nd is more = readable and accessible if someone else has to maintain the codebase = someday. >=20 > Just my two cents, this isn=92t a criticism, I just enjoy open = discussion to find the optimal solution to any given problem :) >=20 > -Brian B. >=20 >=20 >> On Mar 14, 2015, at 11:48 AM, Donovan Brooke wrote: >>=20 >> Nice Brian! we think alike. >>=20 >> On looking at my IsSet function, which is similar to yours..=20 >> I do rather: >> [then]T=3DT[/then] >> [else]T=3DF[/then] >>=20 >> This makes my call look something like this: >>=20 >> [showif [IsSet selector]] >> [include file=3Dblank_page.inc] >> [/showif] >>=20 >> Sincerely, >> Donovan >>=20 >>=20 >>=20 >>=20 >> On Mar 13, 2015, at 7:33 PM, Brian Burton wrote: >>=20 >>> This is what I use >>>=20 >>> [function name=3D?] >>> [!] return T/F based on if a field exists and has a value[/!] >>> [!] incoming variables: the name of the field to be tested i.e. [? = field] [/!] >>> [If = ("[url][interpret][[params_string]][/interpret][/url]"!"%5B[interpret][par= ams_string][/interpret]%5D") & = ("[url][interpret][[params_string]][/interpret][/url]"!"")] >>> [Then][return]T[/return][/Then] >>> [Else][return]F[/return][/Else] >>> [/If] >>> [/function] >>>=20 >>> usage: [showif [? selector]=3DF] [include blank_page.inc] [/showif] >>>=20 >>>=20 >>>=20 >=20 >=20 > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us Donovan Brooke

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[showif],[refferer],[include] in errormessages.db (2002) JavaScript (1998) OT: Making demo movies (2002) Rumpus & WebCat (1998) [UPPERCASE] (1997) International Orders (1998) PCS Frames (1997) Reverse dating (1999) Email Formatting (2001) Logging purchases (1997) [OT] Airport Problem (2003) Reloading Shopping Carts (1998) multi-table date sort problem thingy (2002) Weird G3 Happenings. (1998) 2002 08 15 chat, reformatted (2002) logging in a user (1999) Function defined inside Scope context (2005) Search in 2 or more catalogs (1997) searchable list archive (1997) Sendmail problem (2001)