]> gitweb.factorcode.org Git - factor.git/commitdiff
interpolate: don't break backwards compatibility.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Apr 2015 03:22:29 +0000 (20:22 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Apr 2015 03:22:29 +0000 (20:22 -0700)
basis/db/sqlite/sqlite.factor
basis/interpolate/interpolate-docs.factor
basis/interpolate/interpolate-tests.factor
basis/interpolate/interpolate.factor
basis/tools/scaffold/scaffold.factor

index 545403e678fbc5444c1cc285c1724ae488d48bf2..ff9152cc3c137a6de3eb0f2b42c9223ffe8dd394 100644 (file)
@@ -206,7 +206,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
             SELECT RAISE(ROLLBACK, 'insert on table "${table-name}" violates foreign key constraint "fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
             WHERE  (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : insert-trigger-not-null ( -- string )
     """
@@ -217,7 +217,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
             WHERE NEW.${table-id} IS NOT NULL
                 AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : update-trigger ( -- string )
     """
@@ -227,7 +227,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
             SELECT RAISE(ROLLBACK, 'update on table "${table-name}" violates foreign key constraint "fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
             WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : update-trigger-not-null ( -- string )
     """
@@ -238,7 +238,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
             WHERE NEW.${table-id} IS NOT NULL
                 AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : delete-trigger-restrict ( -- string )
     """
@@ -248,7 +248,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
             SELECT RAISE(ROLLBACK, 'delete on table "${foreign-table-name}" violates foreign key constraint "fkd_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
             WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = OLD.${foreign-table-id}) IS NOT NULL;
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : delete-trigger-cascade ( -- string )
     """
@@ -257,7 +257,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
         FOR EACH ROW BEGIN
             DELETE from ${table-name} WHERE ${table-id} = OLD.${foreign-table-id};
         END;
-    """ interpolate ;
+    """ interpolate>string ;
 
 : can-be-null? ( -- ? )
     "sql-spec" get modifiers>> [ +not-null+ = ] any? not ;
index 6953266edd54735f9ad0b7f4d48e0219f32b2691..768b2e9025e78b9f059d560fdba98ddff1b94aec 100644 (file)
@@ -1,24 +1,24 @@
 USING: help.markup help.syntax io math strings ;
 IN: interpolate
 
-HELP: interpolate.
+HELP: interpolate
 { $values { "str" string } }
 { $description "String interpolation using named variables and/or stack arguments, writing to the " { $link output-stream } "." }
 { $examples
     { $example
         "USING: interpolate ;"
-        "\"Bob\" \"Alice\" \"Hi ${0}, it's ${1}.\" interpolate."
+        "\"Bob\" \"Alice\" \"Hi ${0}, it's ${1}.\" interpolate"
         "Hi Bob, it's Alice."
     }
     { $example
         "USING: interpolate namespaces ;"
-        "\"Fred\" \"name\" [ \"Hi ${name}\" interpolate. ] with-variable"
+        "\"Fred\" \"name\" [ \"Hi ${name}\" interpolate ] with-variable"
         "Hi Fred"
     }
 } ;
 
-HELP: interpolate
+HELP: interpolate>string
 { $values { "str" string } { "newstr" string } }
 { $description "String interpolation using named variables and/or stack arguments, captured as a " { $link string } "." } ;
 
-{ interpolate interpolate. } related-words
+{ interpolate interpolate>string } related-words
index 985e5df6b4a8d9adacd15bbb1d826e07cc792abe..d456ce0a5c98454889499b96a22ad9d2add8f848 100644 (file)
@@ -3,25 +3,25 @@
 USING: interpolate io.streams.string namespaces tools.test locals ;
 IN: interpolate.tests
 
-{ "A B" } [ "A" "B" "${0} ${1}" interpolate ] unit-test
-{ "B A" } [ "A" "B" "${1} ${0}" interpolate ] unit-test
-{ "C A" } [ "A" "B" "C" "${2} ${0}" interpolate ] unit-test
+{ "A B" } [ "A" "B" "${0} ${1}" interpolate>string ] unit-test
+{ "B A" } [ "A" "B" "${1} ${0}" interpolate>string ] unit-test
+{ "C A" } [ "A" "B" "C" "${2} ${0}" interpolate>string ] unit-test
 
 { "Hello, Jane." } [
     "Jane" "name" set
-    "Hello, ${name}." interpolate
+    "Hello, ${name}." interpolate>string
 ] unit-test
 
 { "Mr. John" } [
     "John" "name" set
-    "Mr." "${0} ${name}" interpolate
+    "Mr." "${0} ${name}" interpolate>string
 ] unit-test
 
 { "Sup Dawg, we heard you liked rims, so we put rims on your rims so you can roll while you roll." } [
     "Dawg" "name" set
     "rims" "noun" set
     "roll" "verb" set
-    "Sup ${name}, we heard you liked ${noun}, so we put ${noun} on your ${noun} so you can ${verb} while you ${verb}." interpolate
+    "Sup ${name}, we heard you liked ${noun}, so we put ${noun} on your ${noun} so you can ${verb} while you ${verb}." interpolate>string
 ] unit-test
 
 { "Oops, I accidentally the whole economy..." } [
index c1595e2a3749589066f6560d20599bd87355696d..ccfcf6c7f27ff4439858656b74d9840019bbc633 100644 (file)
@@ -57,11 +57,11 @@ TUPLE: stack-var n ;
 
 PRIVATE>
 
-MACRO: interpolate. ( str -- )
+MACRO: interpolate ( str -- )
     [ [ get ] ] interpolate-quot ;
 
-: interpolate ( str -- newstr )
-    [ interpolate. ] with-string-writer ; inline
+: interpolate>string ( str -- newstr )
+    [ interpolate ] with-string-writer ; inline
 
 : interpolate-locals ( str -- quot )
     [ dup search [ [ ] ] [ [ get ] ] ?if ] interpolate-quot ;
index 3f1a983e1485924f8589aa87f7190eea97758b4b..326aef5cba3614c81c1061aa3d1747fcc8d1f528 100644 (file)
@@ -332,7 +332,7 @@ ${example-indent}    ""
 ${example-indent}    ""
 ${example-indent}}
 """
-            interpolate.
+            interpolate
         ] with-variable
     ] with-variable ;