Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: tweak built-in functions section & move dump section here #13841

Merged
merged 2 commits into from Mar 27, 2022

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Mar 27, 2022

dump is mentioned in the interface docs and isn't really an 'advanced' feature. It belongs as a built-in function even though it has special semantics (just like it methods are still methods).

Add println subheading.
Make 'Printing custom types' a subheading of println.
Change print functions to take IStr, not string and note IStr is not public. Note that print functions can take other printable types.
Mention dump in built-in functions list.

`dump` is mentioned in the interface docs and isn't really an
'advanced' feature. It belongs as a built-in function even though it
has special semantics (just like `it` methods are still methods).

Add `println` subheading.
Make 'Printing custom types' a subheading of `println`.
Change `print` functions to take IStr, not string and note IStr is not
public.
Add `dump(Expr)` to built-in functions list.
@Larpon
Copy link
Contributor

Larpon commented Mar 27, 2022

Although more correct, I think println(s IStr) might confuse newcomers 🤔 "What's IStr?" " Where's IStr defined?" <- that sort of questions will flow in I think 🤷‍♂️

@spytheman
Copy link
Member

Change print functions to take IStr, not string and note IStr is not public.

They do take string however, not IStr - the conversion is compiler magic currently, the functions themselves are ordinary V functions, accepting ordinary string type values.

@spytheman
Copy link
Member

vlib/builtin/builtin.c.v:130:pub fn eprintln(s string) {
vlib/builtin/builtin.c.v:154:pub fn eprint(s string) {
vlib/builtin/builtin.c.v:196:pub fn print(s string) {
vlib/builtin/builtin.c.v:213:pub fn println(s string) {

@ntrel
Copy link
Contributor Author

ntrel commented Mar 27, 2022

OK, updated.

@spytheman spytheman merged commit c7a9242 into vlang:master Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants