From 03b36b159fc627d58067a45a58a9100e5ae165b2 Mon Sep 17 00:00:00 2001 From: "HOT-ROD\\craig" Date: Sun, 24 Jun 2018 00:50:15 +0100 Subject: [PATCH] Added more comments explaing the F# naming gotchas. --- BrittleFish/ConsoleCommands.fs | 16 +++++++++++++ BrittleFishCore/ConsoleCommands.fs | 36 +++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/BrittleFish/ConsoleCommands.fs b/BrittleFish/ConsoleCommands.fs index e7651e8..fc177c5 100644 --- a/BrittleFish/ConsoleCommands.fs +++ b/BrittleFish/ConsoleCommands.fs @@ -44,6 +44,22 @@ [ libtest3 \"Craig Oates\"">] let libtest3 name = String.Format("Result: {0}", LibraryTest3 name) + (* + WARNING: Here are some gotchas. + =============================== + (I will explain using "test 1" as the example but it applies to all of the below.) + This command-method looks like it works but it is a false-positive. + The reason why it "works" in this instance is because there is a command-method called "Test" up above (line 13). + Console.Waterworks interprets the input as "Test" is the command-method and "1" is a parameter. + The same goes for the others with a space in their name. + Because Test does not take any parameteres, Console.Waterworks ignores the extra input from the user. + Console.Waterworks only worries about the parameters when the command-method specifies it requires them. + + GENERAL RULE: + ============= + Avoid using F# features for creating variables, functions Etc. with spaces in them. + *) + [] [] [] diff --git a/BrittleFishCore/ConsoleCommands.fs b/BrittleFishCore/ConsoleCommands.fs index 2ff88c8..e8ea68e 100644 --- a/BrittleFishCore/ConsoleCommands.fs +++ b/BrittleFishCore/ConsoleCommands.fs @@ -5,13 +5,12 @@ open Console.Waterworks.Core open Console.Waterworks.Core.Attributes open FunkyFishCore // This is where the "LibraryTest" functions are -- in BFLibCore - (* + [] [] [] [ test">] let test() = "The console is working" - *) [] [] @@ -45,35 +44,50 @@ [ libtest3 \"Craig Oates\"">] let libtest3 name = String.Format("Result: {0}", LibraryTest3 name) + (* + WARNING: Here are some gotchas. + =============================== + (I will explain using "test 1" as the example but it applies to all of the below.) + This command-method looks like it works but it is a false-positive. + The reason why it "works" in this instance is because there is a command-method called "Test" up above (line 13). + Console.Waterworks interprets the input as "Test" is the command-method and "1" is a parameter. + The same goes for the others with a space in their name. + Because Test does not take any parameteres, Console.Waterworks ignores the extra input from the user. + Console.Waterworks only worries about the parameters when the command-method specifies it requires them. + + GENERAL RULE: + ============= + Avoid using F# features for creating variables, functions Etc. with spaces in them. + *) + [] [] [] [ test 1">] let ``test 1``() = "Result: Test 1 working" + (* This does not work.*) [] - [] + [] [] - [ test 2 ... or ... > test-2">] + [ > test-2">] let ``test-2``() = "Result: Test 2 working" - (*This works when you enter "test 2" or "test-2". - THIS IS DIFFERENT THaN THE FULL DOT-NET FRAMEWORK VERSION.*) + (* This does work. *) + [] [] [] [ test 3">] let """test 3""" = "Result: Test 3 working" - (*This is not displayed in the help section, regardless of the attributes. - It still works if you enter the command into the console, though.*) + (* This does not work. *) + [] [] [] [ test 4">] let """test-4""" = "Result: Test 4 working" - (* This only works when you type "test 4" not ideal but better then nothing. - This is not displayed in the help section, regardless of the attributes. - It still works if you enter the command in the console, though.*) + (* This does not work. *)